diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-03-07 06:00:19 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-03-07 06:00:19 +0000 |
commit | ca049bd1773c13c592b193878766524c45c16c92 (patch) | |
tree | 18fa29c8022ddfbd6e3991734fa38413604cf804 /lib/libc/gen/confstr.c | |
parent | 96f7858c579285ea557186f5d0c3148fec0d2edf (diff) |
Oops: confstr()'s return value should include the NUL in its count
Problem pointed out by Andres Perera (andres.p (at) zoho.com)
Diffstat (limited to 'lib/libc/gen/confstr.c')
-rw-r--r-- | lib/libc/gen/confstr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/gen/confstr.c b/lib/libc/gen/confstr.c index c4352648e51..0023a5e648c 100644 --- a/lib/libc/gen/confstr.c +++ b/lib/libc/gen/confstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: confstr.c,v 1.9 2013/03/01 21:19:42 guenther Exp $ */ +/* $OpenBSD: confstr.c,v 1.10 2013/03/07 06:00:18 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -57,7 +57,7 @@ confstr(int name, char *buf, size_t len) { switch (name) { case _CS_PATH: - return (strlcpy(buf, _PATH_STDPATH, len)); + return (strlcpy(buf, _PATH_STDPATH, len) + 1); /* no configuration-defined value */ case _CS_POSIX_V6_ILP32_OFF32_CFLAGS: @@ -111,13 +111,13 @@ confstr(int name, char *buf, size_t len) return (1); case _CS_POSIX_V7_THREADS_LDFLAGS: - return (strlcpy(buf, "-lpthread", len)); + return (strlcpy(buf, "-lpthread", len) + 1); case _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS: - return (strlcpy(buf, v6_width_restricted_envs, len)); + return (strlcpy(buf, v6_width_restricted_envs, len) + 1); case _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: - return (strlcpy(buf, v7_width_restricted_envs, len)); + return (strlcpy(buf, v7_width_restricted_envs, len) + 1); default: errno = EINVAL; |