From 02a6f15567557da3c44026be5727cd3a84cc1ecf Mon Sep 17 00:00:00 2001 From: shin Date: Thu, 30 Mar 2000 01:50:15 +0000 Subject: Prevent buffer overflow. PR: bin/17657 Submitted by: tanimura --- sbin/routed/table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sbin/routed/table.c') diff --git a/sbin/routed/table.c b/sbin/routed/table.c index b7e826e..d7bab2f 100644 --- a/sbin/routed/table.c +++ b/sbin/routed/table.c @@ -617,6 +617,7 @@ ag_check(naddr dst, } +#define NAME0_LEN 14 static const char * rtm_type_name(u_char type) { @@ -636,12 +637,12 @@ rtm_type_name(u_char type) "RTM_DELADDR", "RTM_IFINFO" }; - static char name0[10]; + static char name0[NAME0_LEN]; if (type > sizeof(rtm_types)/sizeof(rtm_types[0]) || type == 0) { - sprintf(name0, "RTM type %#x", type); + snprintf(name0, NAME0_LEN, "RTM type %#x", type); return name0; } else { return rtm_types[type-1]; -- cgit v1.1