Package: src:ntp
Version: 1:4.2.6.p3+dfsg-2
Severity: serious
Tags: patch
User: debian-...@lists.debian.org
Usertags: kfreebsd

Hi!

ntp is now failing to build on the kfreebsd-* arches.  Some code is
failing the -Wformat-security build hardening test, and this is being
treated as an error during build.  (I'm not sure why this is only the
case on kfreebsd?)

Anyway, I'm attaching a patch to fix the relevant code, which has
allowed me to finish building and then test ntpd on kfreebsd-i386.

Thanks!
Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org
Index: ntp-4.2.6.p3+dfsg/lib/isc/unix/ifiter_sysctl.c
===================================================================
--- ntp-4.2.6.p3+dfsg.orig/lib/isc/unix/ifiter_sysctl.c	2010-12-25 09:40:35.000000000 +0000
+++ ntp-4.2.6.p3+dfsg/lib/isc/unix/ifiter_sysctl.c	2011-12-30 20:30:25.000000000 +0000
@@ -272,10 +272,11 @@
 
 		return (ISC_R_SUCCESS);
 	} else {
-		printf(isc_msgcat_get(isc_msgcat, ISC_MSGSET_IFITERSYSCTL,
-				      ISC_MSG_UNEXPECTEDTYPE,
-				      "warning: unexpected interface list "
-				      "message type\n"));
+		fprintf(stdout, "%s",
+		    isc_msgcat_get(isc_msgcat, ISC_MSGSET_IFITERSYSCTL,
+				   ISC_MSG_UNEXPECTEDTYPE,
+				   "warning: unexpected interface list "
+				   "message type\n"));
 		return (ISC_R_IGNORE);
 	}
 }
Index: ntp-4.2.6.p3+dfsg/ntpd/ntp_config.c
===================================================================
--- ntp-4.2.6.p3+dfsg.orig/ntpd/ntp_config.c	2010-12-25 09:40:34.000000000 +0000
+++ ntp-4.2.6.p3+dfsg/ntpd/ntp_config.c	2011-12-30 20:38:45.000000000 +0000
@@ -2326,7 +2326,7 @@
 		if ((RES_MSSNTP & flags) && !warned_signd) {
 			warned_signd = 1;
 			fprintf(stderr, "%s\n", signd_warning);
-			msyslog(LOG_WARNING, signd_warning);
+			msyslog(LOG_WARNING, "%s", signd_warning);
 		}
 	}
 }
Index: ntp-4.2.6.p3+dfsg/ntpd/ntp_control.c
===================================================================
--- ntp-4.2.6.p3+dfsg.orig/ntpd/ntp_control.c	2010-12-25 09:40:36.000000000 +0000
+++ ntp-4.2.6.p3+dfsg/ntpd/ntp_control.c	2011-12-30 20:35:40.000000000 +0000
@@ -2948,7 +2948,7 @@
 			    " %s", str);
 		}
 		NLOG(NLOG_SYSEVENT)
-		    msyslog(LOG_INFO, statstr);
+		    msyslog(LOG_INFO, "%s", statstr);
 	} else {
 
 		/*
@@ -2980,7 +2980,7 @@
 			    " %s", str);
 		}
 		NLOG(NLOG_PEEREVENT)
-		    msyslog(LOG_INFO, statstr);
+		    msyslog(LOG_INFO, "%s", statstr);
 	}
 	record_proto_stats(statstr);
 #if DEBUG
Index: ntp-4.2.6.p3+dfsg/ntpd/ntpd.c
===================================================================
--- ntp-4.2.6.p3+dfsg.orig/ntpd/ntpd.c	2011-12-30 20:58:45.000000000 +0000
+++ ntp-4.2.6.p3+dfsg/ntpd/ntpd.c	2011-12-30 20:39:39.000000000 +0000
@@ -1284,7 +1284,7 @@
 
 	msyslog(LOG_ERR, "%s:%d: fatal error:", file, line);
 	vsnprintf(errbuf, sizeof(errbuf), format, args);
-	msyslog(LOG_ERR, errbuf);
+	msyslog(LOG_ERR, "%s", errbuf);
 	msyslog(LOG_ERR, "exiting (due to fatal error in library)");
 
 	abort();
@@ -1306,7 +1306,7 @@
 
 	msyslog(LOG_ERR, "%s:%d: unexpected error:", file, line);
 	vsnprintf(errbuf, sizeof(errbuf), format, args);
-	msyslog(LOG_ERR, errbuf);
+	msyslog(LOG_ERR, "%s", errbuf);
 
 	if (++unexpected_error_cnt == MAX_UNEXPECTED_ERRORS)
 	{
Index: ntp-4.2.6.p3+dfsg/ntpd/refclock_oncore.c
===================================================================
--- ntp-4.2.6.p3+dfsg.orig/ntpd/refclock_oncore.c	2010-12-25 09:40:34.000000000 +0000
+++ ntp-4.2.6.p3+dfsg/ntpd/refclock_oncore.c	2011-12-30 20:37:33.000000000 +0000
@@ -4058,7 +4058,7 @@
 
 	snprintf(Msg, sizeof(Msg), "ONCORE[%d]: %s", instance->unit,
 		 msg);
-	syslog(log_level, Msg);
+	syslog(log_level, "%s", Msg);
 
 	i = strlen(msg);
 

Reply via email to