summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2001-01-27 15:24:59 +0000
committerwtc%netscape.com <devnull@localhost>2001-01-27 15:24:59 +0000
commit0e9a9344adc70e0ff3991afec495edf28b9dbf4d (patch)
tree05998cd729f4df2376745d997372f7050fd15eb5
parentc9cf2c686cc86101394a94aba84ac642ecee904d (diff)
downloadnspr-hg-0e9a9344adc70e0ff3991afec495edf28b9dbf4d.tar.gz
Bugzilla bug #54796: PR_InitializeNetAddr and PR_SetNetAddr should zero
the socket address if the 'val' argument is not PR_IpAddrNull. Reviewed by John Myers. (NSPRPUB_CLIENT_BRANCH)
-rw-r--r--pr/src/misc/prnetdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
index 38b81cd1..6c538582 100644
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -924,6 +924,7 @@ PR_IMPLEMENT(PRStatus) PR_InitializeNetAddr(
PRStatus rv = PR_SUCCESS;
if (!_pr_initialized) _PR_ImplicitInitialization();
+ if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet));
addr->inet.family = AF_INET;
addr->inet.port = htons(port);
switch (val)
@@ -949,9 +950,10 @@ PR_IMPLEMENT(PRStatus) PR_SetNetAddr(
PRStatus rv = PR_SUCCESS;
if (!_pr_initialized) _PR_ImplicitInitialization();
- addr->raw.family = af;
if (af == PR_AF_INET6)
{
+ if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->ipv6));
+ addr->ipv6.family = af;
addr->ipv6.port = htons(port);
addr->ipv6.flowinfo = 0;
addr->ipv6.scope_id = 0;
@@ -972,6 +974,8 @@ PR_IMPLEMENT(PRStatus) PR_SetNetAddr(
}
else
{
+ if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet));
+ addr->inet.family = af;
addr->inet.port = htons(port);
switch (val)
{