Blob Blame History Raw
diff -up ntp-4.2.6p5/ntpq/ntpq.c.cve-2015-7852 ntp-4.2.6p5/ntpq/ntpq.c
--- ntp-4.2.6p5/ntpq/ntpq.c.cve-2015-7852	2015-10-21 19:38:34.008129649 +0200
+++ ntp-4.2.6p5/ntpq/ntpq.c	2015-10-21 19:39:40.207742621 +0200
@@ -3449,12 +3449,17 @@ cookedprint(
 			char bv[401];
 			int len;
 
+			/* TALOS-CAN-0063: avoid buffer overrun */
 			atoascii(name, MAXVARLEN, bn, sizeof(bn));
-			atoascii(value, MAXVARLEN, bv, sizeof(bv));
 			if (output_raw != '*') {
+				atoascii(value, MAXVALLEN,
+					 bv, sizeof(bv) - 1);
 				len = strlen(bv);
 				bv[len] = output_raw;
 				bv[len+1] = '\0';
+			} else {
+				atoascii(value, MAXVALLEN,
+					 bv, sizeof(bv));
 			}
 			output(fp, bn, bv);
 		}