Joel, Review/Commit these if happy.
Gedare On Wed, Sep 2, 2015 at 5:54 PM, Martin Galvan <martin.gal...@tallertechnologies.com> wrote: > Closes #2405. > --- > cpukit/libnetworking/rtems/rtems_dhcp.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/cpukit/libnetworking/rtems/rtems_dhcp.c > b/cpukit/libnetworking/rtems/rtems_dhcp.c > index c938ee0..87be238 100644 > --- a/cpukit/libnetworking/rtems/rtems_dhcp.c > +++ b/cpukit/libnetworking/rtems/rtems_dhcp.c > @@ -394,15 +394,23 @@ process_options (unsigned char *optbuf, int optbufSize) > printf ("dhcpc: hostname >= %d bytes\n", MAXHOSTNAMELEN); > len = MAXHOSTNAMELEN-1; > } > - if (sethostname (p, len) < 0) > + if (sethostname (p, len) < 0) { > printf ("dhcpc: can't set host name"); > + } > if (dhcp_hostname != NULL) > { > - dhcp_hostname = realloc (dhcp_hostname, len); > - strncpy (dhcp_hostname, p, len); > - } > - else > + char *tmp = realloc (dhcp_hostname, len); > + if (tmp != NULL) { > + dhcp_hostname = tmp; > + strncpy (dhcp_hostname, p, len); > + } else { /* realloc failed */ > + printf ("dhcpc: realloc failed (%s:%d)", __FILE__, __LINE__); > + free (dhcp_hostname); > + dhcp_hostname = NULL; > + } > + } else { /* dhcp_hostname == NULL */ > dhcp_hostname = strndup (p, len); > + } > break; > > case 7: > -- > 2.5.1 > _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel