about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-12 06:42:00 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-12 06:42:00 +0000
commit8337f053bf0672fffd00f42dbab32f9bba23096d (patch)
tree4d0192d4dad60cb17851dd8384d69efae9455901
parent56ddf355daf2f9812b9560ca9fa698520b7000f8 (diff)
downloadglibc-8337f053bf0672fffd00f42dbab32f9bba23096d.tar.gz
glibc-8337f053bf0672fffd00f42dbab32f9bba23096d.tar.xz
glibc-8337f053bf0672fffd00f42dbab32f9bba23096d.zip
Update.
	* nss/digits_dots.c: Don't pass NULL in h_aliases for successful
	lookup, pass pointer to array with NULL pointer [PR libc/1858].
-rw-r--r--ChangeLog3
-rw-r--r--nss/digits_dots.c16
2 files changed, 13 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 075594fbd6..bfc9e891e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-08-11  Ulrich Drepper  <drepper@redhat.com>
 
+	* nss/digits_dots.c: Don't pass NULL in h_aliases for successful
+	lookup, pass pointer to array with NULL pointer [PR libc/1858].
+
 	* rt/aio_cancel.c: If canceling a specific request which is running
 	*really* do nothing.
 	* rt/aio_misc.h: Add `done' to states of a request.
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
index c3c6de7ce1..cfca343312 100644
--- a/nss/digits_dots.c
+++ b/nss/digits_dots.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by H.J. Lu <hjl@gnu.ai.mit.edu>, 1997.
 
@@ -25,10 +25,11 @@
     {
       const char *cp;
       char *hostname;
-      typedef unsigned char host_addr_t [16];
+      typedef unsigned char host_addr_t[16];
       host_addr_t *host_addr;
-      typedef char *host_addr_list_t [2];
+      typedef char *host_addr_list_t[2];
       host_addr_list_t *h_addr_ptrs;
+      char **h_alias_ptr;
       size_t size_needed;
       int addr_size;
 #ifdef HAVE_TYPE
@@ -102,7 +103,8 @@
       host_addr = (host_addr_t *) buffer;
       h_addr_ptrs = (host_addr_list_t *)
 	((char *) host_addr + sizeof (*host_addr));
-      hostname = (char *) h_addr_ptrs + sizeof (*h_addr_ptrs);
+      h_alias_ptr = (char **) ((char *) h_addr_ptrs + sizeof (*h_addr_ptrs));
+      hostname = (char *) h_alias_ptr + sizeof (*h_alias_ptr);
 
       if (isdigit (name[0]))
 	{
@@ -136,7 +138,8 @@
 		    }
 
 		  resbuf.h_name = strcpy (hostname, name);
-		  resbuf.h_aliases = NULL;
+		  h_alias_ptr[0] = NULL;
+		  resbuf.h_aliases = h_alias_ptr;
 		  (*h_addr_ptrs)[0] = (char *)host_addr;
 		  (*h_addr_ptrs)[1] = (char *)0;
 		  resbuf.h_addr_list = *h_addr_ptrs;
@@ -297,7 +300,8 @@
 		    }
 
 		  resbuf.h_name = strcpy (hostname, name);
-		  resbuf.h_aliases = NULL;
+		  h_alias_ptr[0] = NULL;
+		  resbuf.h_aliases = h_alias_ptr;
 		  (*h_addr_ptrs)[0] = (char *) host_addr;
 		  (*h_addr_ptrs)[1] = (char *) 0;
 		  resbuf.h_addr_list = *h_addr_ptrs;