summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2008-12-12 11:40:59 +0000
committerotto <otto@openbsd.org>2008-12-12 11:40:59 +0000
commita121ddd5a53ca9b08f353ab968c03bb5297e904c (patch)
tree944b3fdbfb0411a2efa4d6a87a048a84e1019ea0 /lib/libc
parent- note that /tmp and /var/tmp are cleaned by daily(8) (diff)
downloadwireguard-openbsd-a121ddd5a53ca9b08f353ab968c03bb5297e904c.tar.xz
wireguard-openbsd-a121ddd5a53ca9b08f353ab968c03bb5297e904c.zip
strcpy -> strlcpy; ok mbalmer@ martynas@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gdtoa/g__fmt.c4
-rw-r--r--lib/libc/gdtoa/gethex.c6
-rw-r--r--lib/libc/gdtoa/strtod.c6
-rw-r--r--lib/libc/gdtoa/strtodg.c6
4 files changed, 14 insertions, 8 deletions
diff --git a/lib/libc/gdtoa/g__fmt.c b/lib/libc/gdtoa/g__fmt.c
index fbccb7d9897..3eeb1bce962 100644
--- a/lib/libc/gdtoa/g__fmt.c
+++ b/lib/libc/gdtoa/g__fmt.c
@@ -56,8 +56,8 @@ g__fmt(char *b, char *s, char *se, int decpt, ULong sign, size_t blen)
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
dlen = strlen(s0);
- if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) {
- strcpy(decimalpoint_cache, s0);
+ if ((decimalpoint_cache = (char*)malloc(dlen + 1))) {
+ strlcpy(decimalpoint_cache, s0, dlen + 1);
s0 = decimalpoint_cache;
}
}
diff --git a/lib/libc/gdtoa/gethex.c b/lib/libc/gdtoa/gethex.c
index 13908e5be79..d3027fbbcbf 100644
--- a/lib/libc/gdtoa/gethex.c
+++ b/lib/libc/gdtoa/gethex.c
@@ -56,9 +56,11 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
const unsigned char *decimalpoint;
static unsigned char *decimalpoint_cache;
if (!(s0 = decimalpoint_cache)) {
+ size_t len;
s0 = (unsigned char*)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;
}
}
diff --git a/lib/libc/gdtoa/strtod.c b/lib/libc/gdtoa/strtod.c
index 62a6ffbf04f..e6a2c699c43 100644
--- a/lib/libc/gdtoa/strtod.c
+++ b/lib/libc/gdtoa/strtod.c
@@ -85,9 +85,11 @@ strtod
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;
}
}
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;
}
}