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

This commit is contained in:
Miroslav Lichvar 2013-12-04 17:27:22 +01:00
parent 4ade270a65
commit 9ec406f621
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,29 @@
commit 4a7d3d7c5de95f4a24bd760af3dd5df7c26bc6e4
Author: Miroslav Lichvar <mlichvar@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)

View File

@ -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"