mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
Prevent buffer overflow.
PR: bin/17657 Submitted by: tanimura
This commit is contained in:
parent
497f9e5a33
commit
230df2f637
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58805
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue