Fix: Always use POSIX locale when parsing -i (#1283277)

This commit is contained in:
Jan Synacek 2015-11-19 14:45:14 +01:00
parent 07bcb8457c
commit 3b7cde0769
2 changed files with 40 additions and 1 deletions

34
iputils-locale-i.patch Normal file
View File

@ -0,0 +1,34 @@
From df41e2509f3bbab594a1c2adba4d404135fc3705 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
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

View File

@ -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 <jsynacek@redhat.com> - 20150815-2
- Fix: Always use POSIX locale when parsing -i (#1283277)
* Thu Sep 24 2015 Jan Synáček <jsynacek@redhat.com> - 20150815-1
- Update to s20150815 (#617934)