Blame SOURCES/ntp-4.2.6p5-cve-2016-9311.patch

5bc849
diff -up ntp-4.2.6p5/ntpd/ntp_control.c.cve-2016-9311 ntp-4.2.6p5/ntpd/ntp_control.c
5bc849
--- ntp-4.2.6p5/ntpd/ntp_control.c.cve-2016-9311	2016-11-21 16:14:42.800048565 +0100
5bc849
+++ ntp-4.2.6p5/ntpd/ntp_control.c	2016-11-21 16:18:24.484590147 +0100
5bc849
@@ -3080,6 +3080,22 @@ report_event(
5bc849
 	if (num_ctl_traps <= 0)
5bc849
 		return;
5bc849
 
5bc849
+	/* [Bug 3119]
5bc849
+	 * Peer Events should be associated with a peer -- hence the
5bc849
+	 * name. But there are instances where this function is called
5bc849
+	 * *without* a valid peer. This happens e.g. with an unsolicited
5bc849
+	 * CryptoNAK, or when a leap second alarm is going off while
5bc849
+	 * currently without a system peer.
5bc849
+	 *
5bc849
+	 * The most sensible approach to this seems to bail out here if
5bc849
+	 * this happens. Avoiding to call this function would also
5bc849
+	 * bypass the log reporting in the first part of this function,
5bc849
+	 * and this is probably not the best of all options.
5bc849
+	 *   -*-perlinger@ntp.org-*-
5bc849
+	 */
5bc849
+	if ((err & PEER_EVENT) && !peer)
5bc849
+		return;
5bc849
+
5bc849
 	/*
5bc849
 	 * Set up the outgoing packet variables
5bc849
 	 */
5bc849
@@ -3104,8 +3120,7 @@ report_event(
5bc849
 #endif /* OPENSSL */
5bc849
 			ctl_putsys(i);
5bc849
 		}
5bc849
-	} else {
5bc849
-		NTP_INSIST(peer != NULL);
5bc849
+	} else if (NULL != peer) { /* paranoia -- skip output */
5bc849
 		rpkt.associd = htons(peer->associd);
5bc849
 		rpkt.status = htons(ctlpeerstatus(peer));
5bc849