avoid heap overrun

Obtained from: KAME
MFC after: 1 day
This commit is contained in:
SUZUKI Shinsuke 2006-03-23 14:39:38 +00:00
parent ed440ef6e4
commit 94182c08be
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157047

View File

@ -656,7 +656,7 @@ get_prefix(struct rainfo *rai)
memcpy(&pp->prefix, a, sizeof(*a));
p = (u_char *)&pp->prefix;
ep = (u_char *)(&pp->prefix + 1);
while (m < lim)
while (m < lim && p < ep)
*p++ &= *m++;
while (p < ep)
*p++ = 0x00;