Subject: lib/3558: possible bug in lib/libc/net/res_init.c; end of _res.lookups is
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 04/30/1997 09:42:01
>Number:         3558
>Category:       lib
>Synopsis:       possible bug in lib/libc/net/res_init.c; end of _res.lookups is tested against NUL but '0' is assigned in some places
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 29 18:05:02 1997
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
	an individual
>Release:        NetBSD-current 1997 Apr 28 (more exactly, after last named import)
>Environment:
System: NetBSD pavlov.enami.ba2.so-net.or.jp 1.2D NetBSD 1.2D (PAVLOV) #241: Tue Apr 29 11:00:42 JST 1997 enami@pavlov.enami.ba2.so-net.or.jp:/b/netbsd/kernel/compile/PAVLOV i386


>Description:
	In file lib/libc/net/gethostnamadr.c, end of _res.lookups is
	tested against NUL, but in some place of
	lib/libc/net/res_init.c, '0' seems to be assigned at the end
	of it.

>How-To-Repeat:
	I found this by reading the source.
>Fix:
	Probably, '\0' or 0 should be used instead of '0'.

Index: res_init.c
===================================================================
RCS file: /a/cvsroot/NetBSD/src/lib/libc/net/res_init.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 res_init.c
*** res_init.c	1997/04/13 16:31:53	1.1.1.4
--- res_init.c	1997/04/30 00:26:23
***************
*** 137,143 ****
  	_res.ndots = 1;
  	_res.pfcode = 0;
  	_res.lookups[0] = 'f';
! 	_res.lookups[1] = '0';
  
  	/* Allow user to override the local domain definition */
  	if ((cp = getenv("LOCALDOMAIN")) != NULL) {
--- 137,143 ----
  	_res.ndots = 1;
  	_res.pfcode = 0;
  	_res.lookups[0] = 'f';
! 	_res.lookups[1] = '\0';
  
  	/* Allow user to override the local domain definition */
  	if ((cp = getenv("LOCALDOMAIN")) != NULL) {
***************
*** 183,189 ****
  	if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
  	    _res.lookups[0] = 'b';
  	    _res.lookups[1] = 'f';
! 	    _res.lookups[2] = '0';
  
  	    /* read the config file */
  	    while (fgets(buf, sizeof(buf), fp) != NULL) {
--- 183,189 ----
  	if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
  	    _res.lookups[0] = 'b';
  	    _res.lookups[1] = 'f';
! 	    _res.lookups[2] = '\0';
  
  	    /* read the config file */
  	    while (fgets(buf, sizeof(buf), fp) != NULL) {
>Audit-Trail:
>Unformatted: