mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-15 23:05:49 +01:00
Fix bogus reporting of interface names, the field returned
in sdl_data is not 0-terminated
This commit is contained in:
parent
070dac0827
commit
cc89db0c68
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58423
@ -136,10 +136,10 @@ sock_ntop(const struct sockaddr *sa, size_t salen)
|
||||
case AF_LINK: {
|
||||
struct sockaddr_dl *sdl = (struct sockaddr_dl *) sa;
|
||||
|
||||
if (sdl->sdl_nlen > 0)
|
||||
snprintf(str, sizeof(str), "%*s",
|
||||
sdl->sdl_nlen, &sdl->sdl_data[0]);
|
||||
else
|
||||
if (sdl->sdl_nlen > 0) {
|
||||
bcopy(&sdl->sdl_data[0], str, sdl->sdl_nlen);
|
||||
str[sdl->sdl_nlen]='\0';
|
||||
} else
|
||||
snprintf(str, sizeof(str), "link#%d", sdl->sdl_index);
|
||||
return(str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user