summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/fix_grouping.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/locale/fix_grouping.c b/lib/libc/locale/fix_grouping.c
index a2675d8..a63889c 100644
--- a/lib/libc/locale/fix_grouping.c
+++ b/lib/libc/locale/fix_grouping.c
@@ -68,7 +68,11 @@ __fix_locale_grouping_str(const char *str) {
n += *src - '0';
}
- *dst++ = n;
+ *dst = n;
+ /* NOTE: assume all input started with "0" as 'no grouping' */
+ if (*dst == '\0')
+ return (dst == (char*)str) ? nogrouping : str;
+ dst++;
}
*dst = '\0';
return str;
OpenPOWER on IntegriCloud