about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-08-22 04:02:53 +0000
committerUlrich Drepper <drepper@redhat.com>2007-08-22 04:02:53 +0000
commit0f8f993ceff73bef51763d0b8addd29b86fad061 (patch)
tree74f7f246f525d7b8da4dedc6d37ff563af6911c1
parent1465dd0f9eeb612ba4bc3e4067a29ea3468f5122 (diff)
downloadglibc-0f8f993ceff73bef51763d0b8addd29b86fad061.tar.gz
glibc-0f8f993ceff73bef51763d0b8addd29b86fad061.tar.xz
glibc-0f8f993ceff73bef51763d0b8addd29b86fad061.zip
[BZ #4726]
	* resolv/res_send.c (__libc_res_nsend): Initialize all of the
	memory allocated for the name server address.
-rw-r--r--ChangeLog4
-rw-r--r--resolv/res_send.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e42f82e5d3..1ede0e9225 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-08-21  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #4726]
+	* resolv/res_send.c (__libc_res_nsend): Initialize all of the
+	memory allocated for the name server address.
+
 	[BZ #4946]
 	* nscd/connections.c (handle_request): Using sendfile always
 	requires that mmap is used for the database.
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 27dd1d4351..23306a2fb4 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -425,9 +425,12 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 				EXT(statp).nsaddrs[n] =
 				    malloc(sizeof (struct sockaddr_in6));
 			if (EXT(statp).nsaddrs[n] != NULL) {
-				memcpy(EXT(statp).nsaddrs[n],
-				       &statp->nsaddr_list[ns],
-				       sizeof (struct sockaddr_in));
+				memset (mempcpy(EXT(statp).nsaddrs[n],
+						&statp->nsaddr_list[ns],
+						sizeof (struct sockaddr_in)),
+					'\0',
+					sizeof (struct sockaddr_in6)
+					- sizeof (struct sockaddr_in));
 				EXT(statp).nssocks[n] = -1;
 				n++;
 			}