1> Test If the problem exists, code:
#include <netdb.h>#include<stdio.h>#include<stdlib.h>#include<string.h>#include<errno.h>#defineCANARY "In_the_coal_mine"struct { Charbuffer[1024x768]; Charcanary[sizeof(CANARY)];} Temp= {"Buffer", CANARY};intMainvoid) { structhostent Resbuf; structHostent *result; intHerrno; intretval; /** * STRLEN (name) = Size_needed-sizeof (*host_addr)-sizeof (*H_ADDR_PTRS)-1; * **/size_t Len=sizeof(Temp.buffer)- -*sizeof(unsignedChar) -2*sizeof(Char*) -1; Charname[sizeof(Temp.buffer)]; memset (Name,'0', Len); Name[len]=' /'; retval= Gethostbyname_r (name, &resbuf, Temp.buffer,sizeof(Temp.buffer), &result, &Herrno); if(strcmp (temp.canary, canary)! =0) {puts ("Vulnerable"); Exit (exit_success); } if(RetVal = =erange) {Puts ("Not vulnerable"); Exit (exit_success); } puts ("should not happen"); Exit (exit_failure);}
2> Compiling test code
GCC Code.c-o testghost
./testghost
Vulnerable or not vulnerable
3> Upgrade
Yum Clean All
Yum Update
[Linux] Upgrading glibc for the GHOST vulnerability