[Git][NTPsec/ntpsec][master] Address Coverity CID 161762: Out-of-bounds read (OVERRUN)
Eric S. Raymond
gitlab at mg.gitlab.com
Sat May 13 13:20:12 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
c9d48c39 by Eric S. Raymond at 2017-05-13T09:19:54-04:00
Address Coverity CID 161762: Out-of-bounds read (OVERRUN)
The message was: Overrunning array of 512 bytes at byte offset 512 by
dereferencing pointer cp. Fix this by strengthening the early bounds
check. Has the additional benefit of avoiding a (very unlikely)
assert check, instead writing nothing.
- - - - -
1 changed file:
- ntpd/ntp_control.c
Changes:
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -1128,12 +1128,11 @@ ctl_putunqstr(
size_t tl;
tl = strlen(tag);
- if (tl >= sizeof(buffer))
+ if (tl + 1 + len >= sizeof(buffer))
return;
memcpy(buffer, tag, tl);
cp = buffer + tl;
if (len > 0) {
- NTP_INSIST(tl + 1 + len <= sizeof(buffer));
*cp++ = '=';
memcpy(cp, data, len);
cp += len;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c9d48c3985caf368b927975d18a057477c35e765
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c9d48c3985caf368b927975d18a057477c35e765
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/20170513/d40431b1/attachment.html>
More information about the vc
mailing list