Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.sbin/tcpdump Pullup 1.8 [he]:
details: https://anonhg.NetBSD.org/src/rev/fb2f5be8922c
branches: netbsd-1-5
changeset: 490046:fb2f5be8922c
user: tv <tv%NetBSD.org@localhost>
date: Wed Nov 01 02:46:46 2000 +0000
description:
Pullup 1.8 [he]:
Change from sprintf() to snprintf() where we may print externally
supplied data of unknown length.
Changes adapted from FreeBSD-SA-00:61.
diffstat:
usr.sbin/tcpdump/print-atalk.c | 9 +++++----
usr.sbin/tcpdump/util.c | 6 +++---
2 files changed, 8 insertions(+), 7 deletions(-)
diffs (64 lines):
diff -r 0b4a1baa8e0a -r fb2f5be8922c usr.sbin/tcpdump/print-atalk.c
--- a/usr.sbin/tcpdump/print-atalk.c Wed Nov 01 02:26:17 2000 +0000
+++ b/usr.sbin/tcpdump/print-atalk.c Wed Nov 01 02:46:46 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print-atalk.c,v 1.7 2000/04/04 05:44:35 itojun Exp $ */
+/* $NetBSD: print-atalk.c,v 1.7.4.1 2000/11/01 02:46:46 tv Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -29,7 +29,7 @@
static const char rcsid[] =
"@(#) Header: print-atalk.c,v 1.48 97/05/28 12:50:58 leres Exp (LBL)";
#else
-__RCSID("$NetBSD: print-atalk.c,v 1.7 2000/04/04 05:44:35 itojun Exp $");
+__RCSID("$NetBSD: print-atalk.c,v 1.7.4.1 2000/11/01 02:46:46 tv Exp $");
#endif
#endif
@@ -522,7 +522,7 @@
{
register struct hnamemem *tp, *tp2;
register int i = (atnet << 8) | athost;
- char nambuf[256];
+ char nambuf[MAXHOSTNAMELEN + 20];
static int first = 1;
FILE *fp;
@@ -569,7 +569,8 @@
if (tp2->addr == i) {
tp->addr = (atnet << 8) | athost;
tp->nxt = newhnamemem();
- (void)sprintf(nambuf, "%s.%d", tp2->name, athost);
+ (void)snprintf(nambuf, sizeof(nambuf),
+ "%s.%d", tp2->name, athost);
tp->name = savestr(nambuf);
return (tp->name);
}
diff -r 0b4a1baa8e0a -r fb2f5be8922c usr.sbin/tcpdump/util.c
--- a/usr.sbin/tcpdump/util.c Wed Nov 01 02:26:17 2000 +0000
+++ b/usr.sbin/tcpdump/util.c Wed Nov 01 02:46:46 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.6.12.1 2000/08/09 22:44:20 itojun Exp $ */
+/* $NetBSD: util.c,v 1.6.12.2 2000/11/01 02:46:46 tv Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
static const char rcsid[] =
"@(#) Header: util.c,v 1.58 97/05/09 14:52:17 leres Exp (LBL)";
#else
-__RCSID("$NetBSD: util.c,v 1.6.12.1 2000/08/09 22:44:20 itojun Exp $");
+__RCSID("$NetBSD: util.c,v 1.6.12.2 2000/11/01 02:46:46 tv Exp $");
#endif
#endif
@@ -161,7 +161,7 @@
}
if (fmt == NULL)
fmt = "#%d";
- (void)sprintf(buf, fmt, v);
+ (void)snprintf(buf, sizeof(buf), fmt, v);
return (buf);
}
Home |
Main Index |
Thread Index |
Old Index