summaryrefslogtreecommitdiff
path: root/lib/libc/gdtoa/strtodg.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gdtoa/strtodg.c')
-rw-r--r--lib/libc/gdtoa/strtodg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gdtoa/strtodg.c b/lib/libc/gdtoa/strtodg.c
index 41ead32decb..159d3c91bae 100644
--- a/lib/libc/gdtoa/strtodg.c
+++ b/lib/libc/gdtoa/strtodg.c
@@ -338,9 +338,11 @@ strtodg
char *decimalpoint;
static char *decimalpoint_cache;
if (!(s0 = decimalpoint_cache)) {
+ size_t len;
s0 = localeconv()->decimal_point;
- if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) {
- strcpy(decimalpoint_cache, s0);
+ len = strlen(s0) + 1;
+ if ((decimalpoint_cache = (char*)malloc(len))) {
+ strlcpy(decimalpoint_cache, s0, len);
s0 = decimalpoint_cache;
}
}