diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-27 14:53:38 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-27 14:53:38 +0000 |
commit | 554534da596c7f40e55ed9977d361d816ec630a6 (patch) | |
tree | aa93f15c1b2afde33ebe3b2b5e06897bf0e7b312 | |
parent | 375c5f59ab1a181ca1897d40106162d76ec17959 (diff) |
buf oflow; thanks tqbf@rdist.org
-rw-r--r-- | sbin/route/route.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index e6fe212941f..96625495021 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.9 1996/09/03 07:29:31 deraadt Exp $ */ +/* $OpenBSD: route.c,v 1.10 1996/10/27 14:53:37 deraadt Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: route.c,v 1.9 1996/09/03 07:29:31 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: route.c,v 1.10 1996/10/27 14:53:37 deraadt Exp $"; #endif #endif /* not lint */ @@ -952,7 +952,7 @@ ns_print(sns) struct ns_addr work; union { union ns_net net_e; u_long long_e; } net; u_short port; - static char mybuf[50]; + static char mybuf[50+MAXHOSTNAMELEN]; char cport[10], chost[25]; char *host = ""; register char *p; @@ -984,7 +984,8 @@ ns_print(sns) else *cport = '\0'; - (void) sprintf(mybuf,"0x%x.%s%s", ntohl(net.long_e), host, cport); + (void) snprintf(mybuf, sizeof mybuf, "0x%x.%s%s", + ntohl(net.long_e), host, cport); return (mybuf); } |