mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04: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
1 changed files with 4 additions and 4 deletions
|
|
@ -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 a new issue