Source-Changes-HG archive

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

[src/trunk]: src/lib/libbluetooth ensure that the buffer is nul-terminated, o...



details:   https://anonhg.NetBSD.org/src/rev/75251c46273e
branches:  trunk
changeset: 767048:75251c46273e
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Jul 07 10:44:50 2011 +0000

description:
ensure that the buffer is nul-terminated, otherwise printing an
empty string will show junk..

diffstat:

 lib/libbluetooth/sdp_data.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r a304a662feb9 -r 75251c46273e lib/libbluetooth/sdp_data.c
--- a/lib/libbluetooth/sdp_data.c       Thu Jul 07 10:27:31 2011 +0000
+++ b/lib/libbluetooth/sdp_data.c       Thu Jul 07 10:44:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdp_data.c,v 1.1 2009/05/12 10:05:06 plunky Exp $      */
+/*     $NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $      */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: sdp_data.c,v 1.1 2009/05/12 10:05:06 plunky Exp $");
+__RCSID("$NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $");
 
 #include <sdp.h>
 #include <stdarg.h>
@@ -358,6 +358,7 @@
        printf("%*s", indent, "");
 
        style |= VIS_NL;
+       buf[0] = '\0';
 
        while (len > 0 && (dst + 5) < (buf + sizeof(buf))) {
                dst = vis(dst, str[0], style, (len > 0 ? str[1] : 0));



Home | Main Index | Thread Index | Old Index