I study about GHOST or CVE-2015-0235 vulnerability. I find out that my system is vulnerable. I write a test program to see the effect of this. but I cant see any thing. hear is my attemps:
user@debian:~$ uname -a
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.57-3 i686 GNU/Linux
user@debian:~$ ./GHOST
vulnerable
user@debian:~$ cat ghost-example.c
#include <string.h>
#include <stdio.h>
#define len 2000000
struct{
char buf[len];
char canary[32];
}buffer;
void main()
{
memset(buffer.buf,'9',len);
buffer.buf[len-1]='\0';
strcpy(buffer.canary,"the vulnerable part of program\n");
gethostbyname(buffer.buf);
printf(buffer.canary);
}
user@debian:~$ gcc ghost-example.c -o ghost-example
user@debian:~$ ./ghost-example
the vulnerable part of program
I cant find out what happen? what is the difference between gethostbyname() ,gethostbyname_r(), gethostbyname2() or gethostbyname2_r. I have a lot of study about this. can anybody help me? thanks.