]> git.wh0rd.org - ICEs.git/blame - 176440/leak.cpp
initial import
[ICEs.git] / 176440 / leak.cpp
CommitLineData
45516216 1// leak.cpp : Defines the entry point for the console application.
2//
3//#include <iostream>
4#include <sys/types.h>
5#include <sys/socket.h>
6#include <netdb.h>
7#include <unistd.h>
8#include <string.h>
9
10unsigned long int atoip(const char * str)
11{
12
13 struct addrinfo *addrInfo, hints;
14
15 memset(&hints, 0, sizeof(hints));
16 hints.ai_family = AF_INET;
17
18 int res = getaddrinfo(str, NULL, &hints, &addrInfo);
19 if (res)
20 return 3;
21
22 for (struct addrinfo *ai = addrInfo; ai; ai = ai->ai_next)
23 {
24 if ((ai->ai_family == AF_INET) && (ai->ai_addrlen ==
25 sizeof(struct sockaddr_in)))
26 {
27 struct sockaddr_in *addr = (struct sockaddr_in*)ai->ai_addr;
28 if (addr) {
29 unsigned long a = addr->sin_addr.s_addr;
30 freeaddrinfo(addrInfo);
31 return a;
32 }
33 }
34 }
35
36 freeaddrinfo(addrInfo);
37 return 0;
38}
39
40
41
42int main(int argc, char* argv[])
43{
44 //std::cout << MegaFunc("Hello world!").c_str();
45 //std::cout << MegaLeak2("127.0.0.1");
46 //std::cout << atoip(L"127.0.0.1") << std::endl;
47 while(atoip("localhost")!=3)
48 {
49 //if(!(i%100000))
50 // std::cout << atoip(L"localhost") << std::endl;
51 //sleep(0);
52 }
53 return 0;
54}