[rpmreaper] fix building with -Werror=format-security (#1037309)

Miroslav Lichvar mlichvar at fedoraproject.org
Wed Dec 4 16:43:17 UTC 2013


commit 9ec406f621cc7d8d3838885cc5a2ea5b15e9e028
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Wed Dec 4 17:27:22 2013 +0100

    fix building with -Werror=format-security (#1037309)

 rpmreaper-0.1.6-format.patch |   29 +++++++++++++++++++++++++++++
 rpmreaper.spec               |    2 ++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/rpmreaper-0.1.6-format.patch b/rpmreaper-0.1.6-format.patch
new file mode 100644
index 0000000..380040a
--- /dev/null
+++ b/rpmreaper-0.1.6-format.patch
@@ -0,0 +1,29 @@
+commit 4a7d3d7c5de95f4a24bd760af3dd5df7c26bc6e4
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date:   Wed Dec 4 16:05:38 2013 +0100
+
+    fix building with -Werror=format-security (rhbz#1037309)
+
+diff --git a/rpm.c b/rpm.c
+index 374ebcd..28069e1 100644
+--- a/rpm.c
++++ b/rpm.c
+@@ -337,15 +337,15 @@ static int rpm_pkg_info(const struct repo *repo, const struct pkgs *p, uint pid)
+ 				r = rpmcname(cmd + j, len, p, pid);
+ 				break;
+ 			case -2:
+-				r = snprintf(cmd + j, len, ((struct rpmrepodata *)repo->data)->root);
++				r = snprintf(cmd + j, len, "%s", ((struct rpmrepodata *)repo->data)->root);
+ 				break;
+ 			case -3:
+-				r = snprintf(cmd + j, len, pager);
++				r = snprintf(cmd + j, len, "%s", pager);
+ 				break;
+ 			default:
+ 				if (idx[i] < 0 || idx[i] >= sizeof (strs) / sizeof (char *))
+ 					return 1;
+-				r = snprintf(cmd + j, len, strs[(int)idx[i]]);
++				r = snprintf(cmd + j, len, "%s", strs[(int)idx[i]]);
+ 				break;
+ 		}
+ 		if (r < 0 || r >= len)
diff --git a/rpmreaper.spec b/rpmreaper.spec
index 70b83ac..7cd8810 100644
--- a/rpmreaper.spec
+++ b/rpmreaper.spec
@@ -11,6 +11,7 @@ Patch0:         rpmreaper-0.1.6-librpm.patch
 Patch1:         rpmreaper-0.1.6-f2help.patch
 Patch2:         rpmreaper-0.1.6-rpmdbiter.patch
 Patch3:         rpmreaper-0.1.6-rpmclifini.patch
+Patch4:         rpmreaper-0.1.6-format.patch
 
 BuildRequires:  ncurses-devel rpm-devel
 Requires:       less rpm
@@ -25,6 +26,7 @@ allows removing unnecessary packages and their dependencies from the system.
 %patch1 -p1 -b .f2help
 %patch2 -p1 -b .rpmdbiter
 %patch3 -p1 -b .rpmclifini
+%patch4 -p1 -b .format
 
 %build
 make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"


More information about the scm-commits mailing list