[Git][NTPsec/ntpsec][master] Fix part of the binary-tumor bug in Mode 6 ctl_putdata()
Eric S. Raymond
gitlab at mg.gitlab.com
Fri Nov 4 12:02:46 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
1a545205 by Eric S. Raymond at 2016-11-04T08:02:31-04:00
Fix part of the binary-tumor bug in Mode 6 ctl_putdata()
The way data was copied before a flush was unnecessary and combined
with some still unknown bug to produce binary garbage in the *middle*
of tags and values.
The cost of removing this extra complication is that because data
items can no longer cross fragment boundaries multipacket responses
will be slightly less space-efficient.
Binary crap is still being emitted, but only on item boundaries.
- - - - -
1 changed file:
- ntpd/ntp_control.c
Changes:
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -1014,7 +1014,6 @@ ctl_putdata(
)
{
int overhead;
- unsigned int currentlen;
const uint8_t * dataend = &rpkt.u.data[CTL_MAX_DATA_LEN];
overhead = 0;
@@ -1039,18 +1038,6 @@ ctl_putdata(
* Save room for trailing junk
*/
while (dlen + overhead + datapt > dataend) {
- /*
- * Not enough room in this one, flush it out.
- */
- currentlen = MIN(dlen, (unsigned int)(dataend - datapt));
-
- memcpy(datapt, dp, currentlen);
-
- datapt += currentlen;
- dp += currentlen;
- dlen -= currentlen;
- datalinelen += currentlen;
-
ctl_flushpkt(CTL_MORE);
}
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1a545205529b17390a7ae93bfc069b5a517c95bc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161104/d311be85/attachment.html>
More information about the vc
mailing list