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

RTEMS trac trac at rtems.org
Wed Dec 16 06:41:48 UTC 2015


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

 * milestone:  4.9.5 => 4.11


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

--

Comment:

 Duplicate of #1983.

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


More information about the bugs mailing list