From d24093c4a638f33b84a722bad7f2488c76437f50 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Sun, 22 Nov 2015 23:13:50 +0100 Subject: Improvements on netbios name detection --- src/lib/protocols/netbios.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lib/protocols/netbios.c b/src/lib/protocols/netbios.c index a651f9219..adf26b7d1 100644 --- a/src/lib/protocols/netbios.c +++ b/src/lib/protocols/netbios.c @@ -29,7 +29,7 @@ /* The function below has been inherited by tcpdump */ static int netbios_name_interpret(char *in, char *out, u_int out_len) { - int ret, len; + int ret = 0, len; char *b; len = (*in++)/2; @@ -42,14 +42,14 @@ static int netbios_name_interpret(char *in, char *out, u_int out_len) { while (len--) { if(in[0] < 'A' || in[0] > 'P' || in[1] < 'A' || in[1] > 'P') { *out = 0; - return(-1); + break; } *out = ((in[0]-'A')<<4) + (in[1]-'A'); in += 2; - out++; + out++, ret++; } - ret = *(--out); + *out = 0; /* Courtesy of Roberto F. De Luca */ @@ -318,7 +318,7 @@ void ndpi_search_netbios(struct ndpi_detection_module_struct *ndpi_struct, struc NDPI_LOG_DEBUG, "found netbios with MSG-type 0x11,0x12,0x13,0x14,0x15 or 0x16\n"); if (ntohl(get_u_int32_t(packet->payload, 4)) == ntohl(packet->iph->saddr)) { - char name[32]; + char name[64]; NDPI_LOG(NDPI_PROTOCOL_NETBIOS, ndpi_struct, NDPI_LOG_DEBUG, "found netbios with checked ip-address.\n"); -- cgit v1.2.3