diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/_strerror.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/getdomain.c | 7 | ||||
-rw-r--r-- | sysdeps/mach/_strerror.c | 8 |
3 files changed, 12 insertions, 7 deletions
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c index 4a9b032..ae520f3 100644 --- a/sysdeps/generic/_strerror.c +++ b/sysdeps/generic/_strerror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 93, 95, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1991, 93, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,7 +56,7 @@ __strerror_r (int errnum, char *buf, size_t buflen) buffer size. */ q = __mempcpy (buf, unk, MIN (unklen, buflen)); if (unklen < buflen) - __stpncpy (q, p, buflen - unklen); + memcpy (q, p, MIN (&numbuf[21] - p, buflen - unklen)); /* Terminate the string in any case. */ if (buflen > 0) diff --git a/sysdeps/generic/getdomain.c b/sysdeps/generic/getdomain.c index 250aec6..40a5951 100644 --- a/sysdeps/generic/getdomain.c +++ b/sysdeps/generic/getdomain.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1994, 1995, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ #include <errno.h> #include <unistd.h> +#include <sys/param.h> #include <sys/utsname.h> #include <string.h> @@ -34,11 +35,13 @@ getdomainname (name, len) size_t len; { struct utsname u; + size_t u_len; if (uname (&u) < 0) return -1; - strncpy (name, u.domainname, len); + u_len = strlen (u.domainname); + memcpy (name, u.domainname, MIN (u_len + 1, len)); return 0; } diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c index 7b15994..0dcf264 100644 --- a/sysdeps/mach/_strerror.c +++ b/sysdeps/mach/_strerror.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -65,7 +66,7 @@ __strerror_r (int errnum, char *buf, size_t buflen) buffer size. */ q = __mempcpy (buf, unk, MIN (unklen, buflen)); if (unklen < buflen) - __stpncpy (q, p, buflen - unklen); + memcpy (q, p, MIN (&numbuf[21] - p, buflen - unklen)); /* Terminate the string in any case. */ if (buflen > 0) @@ -103,7 +104,8 @@ __strerror_r (int errnum, char *buf, size_t buflen) { *q++ = ' '; if (unklen + len + 1 < buflen) - __stpncpy (q, p, buflen - unklen - len - 1); + memcpy (q, p, + MIN (&numbuf[21] - p, buflen - unklen - len - 1)); } } |