Prevent buffer overflow.

PR: bin/17657
Submitted by: tanimura
This commit is contained in:
Yoshinobu Inoue 2000-03-30 01:50:15 +00:00
parent 497f9e5a33
commit 230df2f637
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58805

View File

@ -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];