[Bug 1709] New: gethostent_r incorrectly tests pointer validity

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Wed Oct 6 14:52:56 UTC 2010


           Summary: gethostent_r incorrectly tests pointer validity
           Product: RTEMS
           Version: HEAD
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: networking
        AssignedTo: norume at aps.anl.gov
        ReportedBy: timcussins at eml.cc

Created an attachment (id=1054)
 --> (https://www.rtems.org/bugzilla/attachment.cgi?id=1054)
Recommended bugfix for hostf validity test

struct hostent* gethostent_r(char* buf, int len)

is defined in cpukit/libnetworking/libc/gethostbyht.c

and tests variable 'hostf' for validity (line 226) using

if (hostf<0) return 0;

hostf, when invalid, can also be NULL, so I recommend changing this to

if (hostf<=0) return 0;

see attached :)

Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the bugs mailing list