From 3b7cde0769ef1872f02a13b87490386fc81af95d Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 19 Nov 2015 14:45:14 +0100 Subject: [PATCH] Fix: Always use POSIX locale when parsing -i (#1283277) --- iputils-locale-i.patch | 34 ++++++++++++++++++++++++++++++++++ iputils.spec | 7 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 iputils-locale-i.patch diff --git a/iputils-locale-i.patch b/iputils-locale-i.patch new file mode 100644 index 0000000..36d47e0 --- /dev/null +++ b/iputils-locale-i.patch @@ -0,0 +1,34 @@ +From df41e2509f3bbab594a1c2adba4d404135fc3705 Mon Sep 17 00:00:00 2001 +From: Jan Synacek +Date: Thu, 19 Nov 2015 10:15:06 +0100 +Subject: [PATCH] ping: always use POSIX locale when parsing -i + +Interpreting floating-point numbers from the command line based on the +current locale is a bad idea. + +Original bugreport: https://bugzilla.redhat.com/show_bug.cgi?id=1283277 +--- + ping.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/ping.c b/ping.c +index 95a10a7..c42d6eb 100644 +--- a/ping.c ++++ b/ping.c +@@ -259,7 +259,13 @@ main(int argc, char **argv) + char *ep; + + errno = 0; ++#ifdef USE_IDN ++ setlocale(LC_ALL, "C"); ++#endif + dbl = strtod(optarg, &ep); ++#ifdef USE_IDN ++ setlocale(LC_ALL, ""); ++#endif + + if (errno || *ep != '\0' || + !finite(dbl) || dbl < 0.0 || dbl >= (double)INT_MAX / 1000 - 1.0) { +-- +2.5.0 + diff --git a/iputils.spec b/iputils.spec index a45f671..24e67b4 100644 --- a/iputils.spec +++ b/iputils.spec @@ -3,7 +3,7 @@ Summary: Network monitoring tools including ping Name: iputils Version: 20150815 -Release: 1%{?dist} +Release: 2%{?dist} # some parts are under the original BSD (ping.c) # some are under GPLv2+ (tracepath.c) License: BSD and GPLv2+ @@ -21,6 +21,7 @@ Source5: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt Patch0: iputils-rh.patch Patch1: iputils-ifenslave.patch Patch2: iputils-doc.patch +Patch3: iputils-locale-i.patch BuildRequires: docbook-utils perl-SGMLSpm BuildRequires: glibc-kernheaders >= 2.4-8.19 @@ -59,6 +60,7 @@ cp %{SOURCE4} %{SOURCE5} . %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build %ifarch s390 s390x @@ -160,6 +162,9 @@ mv -f RELNOTES.tmp RELNOTES %attr(644,root,root) %{_mandir}/man8/ninfod.8.gz %changelog +* Thu Nov 19 2015 Jan Synáček - 20150815-2 +- Fix: Always use POSIX locale when parsing -i (#1283277) + * Thu Sep 24 2015 Jan Synáček - 20150815-1 - Update to s20150815 (#617934)