diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/_strerror.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/getdomain.c | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c index 4a9b032c86..ae520f32fc 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 250aec68e2..40a59514f0 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; } |