Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sdpquery ensure string buffer is null terminated, fo...



details:   https://anonhg.NetBSD.org/src/rev/4272b9de02f0
branches:  trunk
changeset: 767049:4272b9de02f0
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Jul 07 10:49:38 2011 +0000

description:
ensure string buffer is null terminated, for zero length strings..

diffstat:

 usr.bin/sdpquery/print.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 75251c46273e -r 4272b9de02f0 usr.bin/sdpquery/print.c
--- a/usr.bin/sdpquery/print.c  Thu Jul 07 10:44:50 2011 +0000
+++ b/usr.bin/sdpquery/print.c  Thu Jul 07 10:49:38 2011 +0000
@@ -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));



Home | Main Index | Thread Index | Old Index