1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

arp(8): avoid segfaulting due to out-of-bounds memory access

Fix obvious mistake that sometimes results in reading memory
past end of an array.

PR:		240825
MFC after:	1 week
This commit is contained in:
Eugene Grosbein 2020-01-09 11:58:26 +00:00
parent f2792e5e55
commit 693d381624
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356551

View File

@ -627,8 +627,7 @@ print_entry(struct sockaddr_dl *sdl,
} else
xo_emit("{d:/(incomplete)}{en:incomplete/true}");
for (p = ifnameindex; p && ifnameindex->if_index &&
ifnameindex->if_name; p++) {
for (p = ifnameindex; p && p->if_index && p->if_name; p++) {
if (p->if_index == sdl->sdl_index) {
xo_emit(" on {:interface/%s}", p->if_name);
break;