6cf6cd4
From 3976ef5a20369d8b490907ab2cba2d617305a5e0 Mon Sep 17 00:00:00 2001
6cf6cd4
From: Kamil Dudka <kdudka@redhat.com>
6cf6cd4
Date: Mon, 30 May 2016 16:19:20 +0200
6cf6cd4
Subject: [PATCH] sort: do not use static array 'blanks' in human_numcompare()
6cf6cd4
6cf6cd4
... because the array is not initialized with MB locales.  Note this is
6cf6cd4
rather a conservative fix.  I plan to do more cleanup of the i18n patch
6cf6cd4
in Fedora to prevent mistakes like this in future updates of coreutils.
6cf6cd4
---
6cf6cd4
 src/sort.c | 8 +++-----
6cf6cd4
 1 file changed, 3 insertions(+), 5 deletions(-)
6cf6cd4
6cf6cd4
diff --git a/src/sort.c b/src/sort.c
6cf6cd4
index 9e07ad8..e47b039 100644
6cf6cd4
--- a/src/sort.c
6cf6cd4
+++ b/src/sort.c
8d9eac4
@@ -2304,12 +2304,10 @@ find_unit_order (char const *number)
6cf6cd4
        <none/unknown> < K/k < M < G < T < P < E < Z < Y  */
6cf6cd4
 
6cf6cd4
 static int
6cf6cd4
-human_numcompare (char const *a, char const *b)
6cf6cd4
+human_numcompare (char *a, char *b)
6cf6cd4
 {
6cf6cd4
-  while (blanks[to_uchar (*a)])
6cf6cd4
-    a++;
6cf6cd4
-  while (blanks[to_uchar (*b)])
6cf6cd4
-    b++;
6cf6cd4
+  skipblanks(&a, a + strlen(a));
6cf6cd4
+  skipblanks(&b, b + strlen(b));
6cf6cd4
 
6cf6cd4
   int diff = find_unit_order (a) - find_unit_order (b);
6cf6cd4
   return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
6cf6cd4
-- 
6cf6cd4
2.5.5
6cf6cd4