summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-08-13 15:30:24 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-08-13 15:30:24 +0000
commitc07329174a2b69272e2e5a39701fc942c0c397c7 (patch)
tree41700ac53aafa4aeea3d4e3c8995c508d757644e /lib
parent63d0161b903971442ca759859d39a4c710f1cc8b (diff)
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')
-rw-r--r--lib/libc/gen/vis.c4
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);
}