summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2017-07-27 16:47:43 +0000
committerderaadt <deraadt@openbsd.org>2017-07-27 16:47:43 +0000
commit5b44245bdef731678c5654e8568ec9e08bd990f6 (patch)
treeb9a0c674c35000e1227a42b497a96922e4362ec9
parentbad things can (and will) happen if a threaded program calls fork() and (diff)
downloadwireguard-openbsd-5b44245bdef731678c5654e8568ec9e08bd990f6.tar.xz
wireguard-openbsd-5b44245bdef731678c5654e8568ec9e08bd990f6.zip
Use stdrup, to avoid clang whining about the length parameters being
based upon input being used unsafely (they are safe) ok millert kettenis
-rw-r--r--lib/libc/gdtoa/gethex.c7
-rw-r--r--lib/libc/gdtoa/strtod.c5
-rw-r--r--lib/libc/gdtoa/strtodg.c5
3 files changed, 4 insertions, 13 deletions
diff --git a/lib/libc/gdtoa/gethex.c b/lib/libc/gdtoa/gethex.c
index f521f15c6d6..d48c9ed039b 100644
--- a/lib/libc/gdtoa/gethex.c
+++ b/lib/libc/gdtoa/gethex.c
@@ -57,11 +57,8 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
static unsigned char *decimalpoint_cache;
if (!(s0 = decimalpoint_cache)) {
s0 = (unsigned char*)localeconv()->decimal_point;
- if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
- strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
- s0 = decimalpoint_cache;
- }
- }
+ decimalpoint_cache = strdup(s0);
+ }
decimalpoint = s0;
#endif
#endif
diff --git a/lib/libc/gdtoa/strtod.c b/lib/libc/gdtoa/strtod.c
index ac2283c6249..0fb37fdedf6 100644
--- a/lib/libc/gdtoa/strtod.c
+++ b/lib/libc/gdtoa/strtod.c
@@ -114,10 +114,7 @@ strtod
static int dplen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
- if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
- strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
- s0 = decimalpoint_cache;
- }
+ decimalpoint_cache = strdup(s0);
dplen = strlen(s0);
}
decimalpoint = (char*)s0;
diff --git a/lib/libc/gdtoa/strtodg.c b/lib/libc/gdtoa/strtodg.c
index 753f6bf0ec2..defb4740eb0 100644
--- a/lib/libc/gdtoa/strtodg.c
+++ b/lib/libc/gdtoa/strtodg.c
@@ -363,10 +363,7 @@ strtodg
static int dplen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
- if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
- strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
- s0 = decimalpoint_cache;
- }
+ decimalpoint_cache = strdup(s0);
dplen = strlen(s0);
}
decimalpoint = (char*)s0;