From 6c5b57a85b9a0d1b523edcc05a5a0be8f54fe4fa Mon Sep 17 00:00:00 2001 From: YX Hao Date: Sat, 12 Sep 2020 10:54:33 +0800 Subject: [PATCH] fix host name ending position https://github.com/lifenjoiner/nbtscan/issues/1 --- nbtscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbtscan.c b/nbtscan.c index 374f860..2f3675d 100644 --- a/nbtscan.c +++ b/nbtscan.c @@ -120,7 +120,7 @@ int d_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo) { for(i=0; i< hostinfo->header->number_of_names; i++) { service = hostinfo->names[i].ascii_name[15]; strncpy(name, hostinfo->names[i].ascii_name, 15); - name[16]=0; + name[15]=0; printf("%-17s Service: 0x%02x Flags: 0x%04x\n", name, service, hostinfo->names[i].rr_flags); } }; @@ -173,7 +173,7 @@ int v_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo, c for(i=0; i< hostinfo->header->number_of_names; i++) { service = hostinfo->names[i].ascii_name[15]; strncpy(name, hostinfo->names[i].ascii_name, 15); - name[16]=0; + name[15]=0; unique = !(hostinfo->names[i].rr_flags & 0x0080); if(sf) { printf("%s%s%s%s", inet_ntoa(addr), sf, name, sf);