NetBSD Problem Report #829

From gnats  Sun Feb 26 18:06:22 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id SAA09660 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sun, 26 Feb 1995 18:06:21 -0800
Message-Id: <199502270158.SAA24237@willett.math.utah.edu>
Date: Sun, 26 Feb 95 18:51:47 MST
From: Lon Willett <lon%softt.uucp@math.utah.edu>
Reply-To: willett@math.utah.edu
To: gnats-bugs@NetBSD.ORG
Subject: gethostXXX()/_gethtent() dumps core; fix included
X-Send-Pr-Version: 3.2

>Number:         829
>Category:       lib
>Synopsis:       gethostXXX()/_gethtent() dumps core; fix included
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 26 18:20:01 +0000 1995
>Closed-Date:    Mon Feb 27 02:33:11 +0000 1995
>Last-Modified:  
>Originator:     Lon Willett
>Release:        NetBSD-current 26 Feb 95
>Organization:
none
>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;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Sun Feb 26 18:33:11 PST 1995 
State-Changed-Why:  
fix previously applied, originally supplied by fvdl to current-users. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.