Subject: lib/829: gethostXXX()/_gethtent() dumps core; fix included
To: None <gnats-admin@NetBSD.ORG>
From: Lon Willett <lon%softt.uucp@math.utah.edu>
List: netbsd-bugs
Date: 02/26/1995 18:20:03
>Number: 829
>Category: lib
>Synopsis: gethostXXX()/_gethtent() dumps core; fix included
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 26 18:20:01 1995
>Originator: Lon Willett
>Organization:
none
>Release: NetBSD-current 26 Feb 95
>Environment:
i386 NetBSD
System: NetBSD hilly 1.0A NetBSD 1.0A (HILLY) #132: Thu Feb 23 07:53:57 MST 1995 lon@hilly:/usr/src/sys/arch/i386/compile/HILLY i386
>Description:
_gethtent() has a missing "&" operator, in a typecast
assignment.
Query: why is the typecasting being used at all?
>How-To-Repeat:
Configure "file" searches in /etc/resolv.conf, and try just
about any program that does host name lookups.
>Fix:
The following patch ("diff -u" format) corrects the problem.
--- gethostnamadr.c.orig Sat Feb 25 07:15:33 1995
+++ gethostnamadr.c Sun Feb 26 17:57:19 1995
@@ -441,7 +441,7 @@
/* THIS STUFF IS INTERNET SPECIFIC */
h_addr_ptrs[0] = (char *)&host_addr;
h_addr_ptrs[1] = NULL;
- *((u_int32_t *)host_addr.s_addr) = inet_addr(p);
+ *((u_int32_t *)&host_addr.s_addr) = inet_addr(p);
host.h_addr_list = h_addr_ptrs;
host.h_length = sizeof(u_int32_t);
host.h_addrtype = AF_INET;
>Audit-Trail:
>Unformatted: