summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2008-12-12 11:41:00 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2008-12-12 11:41:00 +0000
commitab7b4d12e46b015ff5a2264ba30ef4dc1489e775 (patch)
treeef1bccde3f23ced27b88db5076d71576e2f12a1d /lib
parent759bd710f8aa6aa1461daba4e86d7f5186c60176 (diff)
strcpy -> strlcpy; ok mbalmer@ martynas@
Diffstat (limited to 'lib')
-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;
}
}