[RTEMS Project] #1709: gethostent_r incorrectly tests pointer validity

RTEMS trac trac at rtems.org
Sat Nov 22 14:26:29 UTC 2014


#1709: gethostent_r incorrectly tests pointer validity
------------------------+----------------------------
 Reporter:  timcussins  |       Owner:  joel.sherrill
     Type:  defect      |      Status:  assigned
 Priority:  normal      |   Milestone:  4.10.3
Component:  networking  |     Version:  4.10
 Severity:  normal      |  Resolution:
 Keywords:              |
------------------------+----------------------------
Changes (by gedare):

 * owner:  norume => joel.sherrill
 * status:  new => assigned
 * version:  HEAD => 4.10
 * milestone:  4.11 => 4.10.3


Old description:

> 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 :)

New description:

 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 :)

--

--
Ticket URL: <http://devel.rtems.org/ticket/1709#comment:2>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list