Fix an off-by-one which could mean writing beyond the end of the array

when copying the interface name.
This code part should probably be rewritten.
This commit is contained in:
bz 2006-12-29 18:44:04 +00:00
parent d9a83430ee
commit 7c57814bdc

View File

@ -321,9 +321,9 @@ retry:
next += nextifm->ifm_msglen;
}
memcpy(name, sdl->sdl_data,
sizeof(name) < sdl->sdl_nlen ?
sizeof(name) <= sdl->sdl_nlen ?
sizeof(name)-1 : sdl->sdl_nlen);
name[sizeof(name) < sdl->sdl_nlen ?
name[sizeof(name) <= sdl->sdl_nlen ?
sizeof(name)-1 : sdl->sdl_nlen] = '\0';
if (all || namesonly) {