fix gcc 7 format-truncation error

This commit is contained in:
Joe Orton 2017-02-15 09:26:22 +00:00
parent c69d4079dd
commit 0586fc36fc
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,15 @@
gcc -Wformat-truncation thinks this might truncate.
diff -uap memcached-1.4.34/util.c.gcc7fmt memcached-1.4.34/util.c
--- memcached-1.4.34/util.c.gcc7fmt
+++ memcached-1.4.34/util.c
@@ -18,7 +18,7 @@
if (isalnum(x) || x == '-' || x == '.' || x == '_' || x == '~') {
uriencode_map[x] = NULL;
} else {
- snprintf(str, 4, "%%%02X", x);
+ snprintf(str, 4, "%%%02hhX", (unsigned char)x);
uriencode_map[x] = str;
str += 3; /* lobbing off the \0 is fine */
}

View File

@ -4,7 +4,7 @@
Name: memcached
Version: 1.4.34
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 0
Summary: High Performance, Distributed Memory Object Cache
@ -15,6 +15,7 @@ Source0: http://www.memcached.org/files/%{name}-%{version}.tar.gz
Source1: memcached.sysconfig
Patch1: memcached-unit.patch
Patch2: memcached-1.4.34-gcc7fmt.patch
BuildRequires: libevent-devel systemd-units
BuildRequires: perl-generators
@ -43,6 +44,7 @@ access to the memcached binary include files.
%prep
%setup -q
%patch1 -p1 -b .unit
%patch2 -p1 -b .gcc7fmt
%build
# compile with full RELRO
@ -121,6 +123,9 @@ exit 0
%{_includedir}/memcached/*
%changelog
* Wed Feb 15 2017 Joe Orton <jorton@redhat.com> - 0:1.4.34-3
- fix gcc 7 format-truncation error
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.4.34-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild