Module Name: src
Committed By: plunky
Date: Thu Jul 7 10:49:39 UTC 2011
Modified Files:
src/usr.bin/sdpquery: print.c
Log Message:
ensure string buffer is null terminated, for zero length strings..
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/sdpquery/print.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/sdpquery/print.c
diff -u src/usr.bin/sdpquery/print.c:1.15 src/usr.bin/sdpquery/print.c:1.16
--- src/usr.bin/sdpquery/print.c:1.15 Thu Jul 7 10:26:00 2011
+++ src/usr.bin/sdpquery/print.c Thu Jul 7 10:49:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.15 2011/07/07 10:26:00 plunky Exp $ */
+/* $NetBSD: print.c,v 1.16 2011/07/07 10:49:38 plunky Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: print.c,v 1.15 2011/07/07 10:26:00 plunky Exp $");
+__RCSID("$NetBSD: print.c,v 1.16 2011/07/07 10:49:38 plunky Exp $");
#include <ctype.h>
#include <iconv.h>
@@ -556,6 +556,7 @@
static char buf[50];
char *dst = buf;
+ buf[0] = '\0';
style |= VIS_NL;
while (len > 0 && (dst + 5) < (buf + sizeof(buf))) {
dst = vis(dst, src[0], style, (len > 1 ? src[1] : 0));