Package: ganglia
Severity: important
Tags: patch

Please enabled hardened build flags through dpkg-buildflags.

Patch attached. (dpkg-buildflags abides "noopt" from DEB_BUILD_OPTIONS)

The hardened build flags exposed missing format strings, for which
I've attached patches as well.

Cheers,
        Moritz
diff -aur ganglia-3.1.7.orig/debian/rules ganglia-3.1.7/debian/rules
--- ganglia-3.1.7.orig/debian/rules	2011-04-07 22:23:10.000000000 +0200
+++ ganglia-3.1.7/debian/rules	2012-01-08 18:33:17.000000000 +0100
@@ -11,20 +11,20 @@
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CFLAGS = -O2 -Wall 
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -g
-endif
+CFLAGS = `dpkg-buildflags --get CFLAGS`
+CFLAGS += -Wall
+LDFLAGS = `dpkg-buildflags --get LDFLAGS`
+CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
+
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 	INSTALL_PROGRAM += -s
 endif
 
-
 config.status: configure
 	dh_testdir
 	# Add here commands to configure the package.
 #	autoreconf
-	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+	./configure CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
 		--prefix=/usr --mandir=\$${prefix}/share/man \
 		--libdir=\$${prefix}/lib \
 		--sysconfdir=/etc/ganglia \
Nur in ganglia-3.1.7/debian: rules~.
diff -aur ganglia-3.1.7.orig/lib/error_msg.c ganglia-3.1.7/lib/error_msg.c
--- ganglia-3.1.7.orig/lib/error_msg.c	2010-02-17 12:05:39.000000000 +0100
+++ ganglia-3.1.7/lib/error_msg.c	2012-01-08 18:35:42.000000000 +0100
@@ -153,7 +153,7 @@
 
    if (daemon_proc)
      {
-        syslog (level, buf);
+        syslog (level, "%s", buf);
      }
    else
      {
Nur in ganglia-3.1.7/lib: error_msg.c~.
diff -aur ganglia-3.1.7.orig/gmond/gmond.c ganglia-3.1.7/gmond/gmond.c
--- ganglia-3.1.7.orig/gmond/gmond.c	2010-02-17 12:05:39.000000000 +0100
+++ ganglia-3.1.7/gmond/gmond.c	2012-01-08 18:38:56.000000000 +0100
@@ -2789,7 +2789,7 @@
 
   if(args_info.default_config_flag)
     {
-      fprintf(stdout, default_gmond_configuration);
+      fprintf(stdout, "%s", default_gmond_configuration);
       fflush( stdout );
       exit(0);
     }
Nur in ganglia-3.1.7/gmond: gmond.c~.

Reply via email to