diff options
author | luigi <luigi@FreeBSD.org> | 2000-03-21 12:09:23 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2000-03-21 12:09:23 +0000 |
commit | 5485a32a23d8e68176e322e29d9760ff050d76ba (patch) | |
tree | 08c6320825036872893e1183f62aba2e8f85b646 | |
parent | d7816647eff32abf1cc239b5db9d44b579c4de47 (diff) | |
download | FreeBSD-src-5485a32a23d8e68176e322e29d9760ff050d76ba.zip FreeBSD-src-5485a32a23d8e68176e322e29d9760ff050d76ba.tar.gz |
Fix bogus reporting of interface names, the field returned
in sdl_data is not 0-terminated
-rw-r--r-- | release/picobsd/tinyware/ns/ns.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/release/picobsd/tinyware/ns/ns.c b/release/picobsd/tinyware/ns/ns.c index acabac2..a5e6a25 100644 --- a/release/picobsd/tinyware/ns/ns.c +++ b/release/picobsd/tinyware/ns/ns.c @@ -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); } |