[PATCH] Fix segv in nss_files

Jakub Jelinek jakub@redhat.com
Sat Sep 2 14:34:00 GMT 2000


Hi!

With multi on in /etc/host.conf and lines like:
1.2.3.4 x
1.2.3.4 x y
in /etc/hosts gethostbyname segfaults (a while loop in HOST_DB_LOOKUP loops
forever because cnt is never incremented).
Fixed by following patch.

2000-09-02  Jakub Jelinek  <jakub@redhat.com>

	* nss/nss_files/files-hosts.c (HOST_DB_LOOKUP): Increment counter in
	the loop.

--- libc/nss/nss_files/files-hosts.c.jj	Thu Jul 27 15:59:38 2000
+++ libc/nss/nss_files/files-hosts.c	Sat Sep  2 23:19:11 2000
@@ -200,6 +200,7 @@ _nss_files_get##name##_r (proto,					   
 		      bufferend = (__stpcpy (bufferend,			      \
 					     tmp_result_buf.h_aliases[cnt])   \
 				   + 1);				      \
+		      ++cnt;						      \
 		    }							      \
 									      \
 		  if (cnt < newaliases)					      \

	Jakub


More information about the Libc-hacker mailing list