[Linux] Upgrading glibc for the GHOST vulnerability

Source: Internet
Author: User

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


Vulnerable or not vulnerable

3> Upgrade

Yum Clean All

Yum Update

[Linux] Upgrading glibc for the GHOST vulnerability

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.