From: Alexandra Ellwood Date: Mon, 19 Mar 2007 21:17:02 +0000 (+0000) Subject: pullup from trunk X-Git-Tag: kfw-3.2.0-beta1~70 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=16e3f98a766bed7f0f492cc58b3b0c31a95c9e47;p=krb5.git pullup from trunk ------------------------------------------------------------------------ r19235 | lxs | 2007-03-19 16:21:54 -0400 (Mon, 19 Mar 2007) | 9 lines ticket: new target_version: 1.6.1 tags: pullup subject: Zero sockaddrs in fai_add_entry() so we can compare them with memcmp() If we don't zero the struct sockaddrs in fai_add_entry() then any sin_zero fields will be left as random memory and the memcmp() will return that the addresses are different even if they aren't. ------------------------------------------------------------------------ ticket: 5476 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19236 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/support/fake-addrinfo.c b/src/util/support/fake-addrinfo.c index 6db94cf48..325418983 100644 --- a/src/util/support/fake-addrinfo.c +++ b/src/util/support/fake-addrinfo.c @@ -545,6 +545,7 @@ static inline int fai_add_entry (struct addrinfo **result, void *addr, sin4 = malloc (sizeof (struct sockaddr_in)); if (sin4 == 0) return EAI_MEMORY; + memset (sin4, 0, sizeof (struct sockaddr_in)); /* for sin_zero */ n->ai_addr = (struct sockaddr *) sin4; sin4->sin_family = AF_INET; sin4->sin_addr = *(struct in_addr *)addr; @@ -559,6 +560,7 @@ static inline int fai_add_entry (struct addrinfo **result, void *addr, sin6 = malloc (sizeof (struct sockaddr_in6)); if (sin6 == 0) return EAI_MEMORY; + memset (sin6, 0, sizeof (struct sockaddr_in6)); /* for sin_zero */ n->ai_addr = (struct sockaddr *) sin6; sin6->sin6_family = AF_INET6; sin6->sin6_addr = *(struct in6_addr *)addr;