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:
Bjoern A. Zeeb 2006-12-29 18:44:04 +00:00
parent 5583491044
commit 3ca72aeb09

View File

@ -321,9 +321,9 @@ main(int argc, char *argv[])
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) {