[Git][NTPsec/ntpsec][master] decodenetnum(): don't return random data on fail.

Gary E. Miller gitlab at mg.gitlab.com
Wed Apr 12 19:00:37 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
3d0423de by Gary E. Miller at 2017-04-12T11:59:11-07:00
decodenetnum(): don't return random data on fail.

- - - - -


1 changed file:

- libntp/decodenetnum.c


Changes:

=====================================
libntp/decodenetnum.c
=====================================
--- a/libntp/decodenetnum.c
+++ b/libntp/decodenetnum.c
@@ -40,6 +40,7 @@ decodenetnum(
 
 	char ip[INET6_ADDRSTRLEN];
 
+	ZERO(*netnum);               /* don't return random data on fail */
 	NTP_REQUIRE(num != NULL);
 	/* Quickly reject empty or impossibly long inputs. */
 	if(numlen == 0 ||
@@ -124,7 +125,6 @@ decodenetnum(
 
 	NTP_INSIST(ai->ai_addrlen <= sizeof(*netnum));
 	if(netnum) {
-		ZERO(*netnum);
 		memcpy(netnum, ai->ai_addr, ai->ai_addrlen);
 	}
 	freeaddrinfo(ai);



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3d0423deec390de47e514aad1327384e7bcef5d1

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3d0423deec390de47e514aad1327384e7bcef5d1
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170412/dccced7d/attachment.html>


More information about the vc mailing list