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:
brooks 2004-01-31 22:59:03 +00:00
parent 2eed8d0864
commit ee34d661df

View File

@ -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)