Use memcpy plus a manual NUL termination when copying the interface name
from the sdl because strlcpy requires that the source string be NUL-terminated unlike strncpy. Submitted by: Peter Jeremy <PeterJeremy at optushome dot com dot au>
This commit is contained in:
parent
4543f32e21
commit
bbe513dbf8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125280
@ -596,9 +596,11 @@ main(int argc, char *argv[])
|
||||
addrcount++;
|
||||
next += nextifm->ifm_msglen;
|
||||
}
|
||||
strlcpy(name, sdl->sdl_data,
|
||||
sizeof(name) <= sdl->sdl_nlen ?
|
||||
sizeof(name) : sdl->sdl_nlen + 1);
|
||||
memcpy(name, sdl->sdl_data,
|
||||
sizeof(name) < sdl->sdl_nlen ?
|
||||
sizeof(name)-1 : sdl->sdl_nlen);
|
||||
name[sizeof(name) < sdl->sdl_nlen ?
|
||||
sizeof(name)-1 : sdl->sdl_nlen] = '\0';
|
||||
|
||||
if (all || namesonly) {
|
||||
if (uponly)
|
||||
|
Loading…
Reference in New Issue
Block a user