diff options
author | 2001-08-13 15:30:23 +0000 | |
---|---|---|
committer | 2001-08-13 15:30:23 +0000 | |
commit | d7063c97e148702192e3271e03cd43e3c9e52c95 (patch) | |
tree | b072e288a823df2415f1e0005db5818d07692a6b /lib/libc | |
parent | Declare globals made extern in sys/sem.h; naddy@ (diff) | |
download | wireguard-openbsd-d7063c97e148702192e3271e03cd43e3c9e52c95.tar.xz wireguard-openbsd-d7063c97e148702192e3271e03cd43e3c9e52c95.zip |
Explicitly NUL terminate dst in strvis() and strvisx() in case
we are passes an empty string. vis() and strnvis() were already OK.
Based on patch by wilfried@openbsd.org
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/vis.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index e15a7427d11..45abbf7aff7 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: vis.c,v 1.6 2000/11/21 00:47:28 millert Exp $"; +static char rcsid[] = "$OpenBSD: vis.c,v 1.7 2001/08/13 15:30:23 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -166,6 +166,7 @@ strvis(dst, src, flag) for (start = dst; (c = *src);) dst = vis(dst, c, flag, *++src); + *dst = '\0'; return (dst - start); } @@ -227,5 +228,6 @@ strvisx(dst, src, len, flag) } if (len) dst = vis(dst, *src, flag, '\0'); + *dst = '\0'; return (dst - start); } |