From d358ef1e71e7808eb24143c8161378b295c60f4e Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Fri, 10 Jun 2011 12:59:05 -0500 Subject: [PATCH] Null-terminate the string created by decode_netbios_name BiF. (initially observed through failures of bifs.netbios-functions unit test) --- src/bro.bif | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bro.bif b/src/bro.bif index 0eea41bf7d..2c1f2c316c 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -1348,7 +1348,7 @@ function fmt_ftp_port%(a: addr, p: port%): string function decode_netbios_name%(name: string%): string %{ char buf[16]; - char result[32]; + char result[16]; const u_char* s = name->Bytes(); int i, j; @@ -1367,7 +1367,10 @@ function decode_netbios_name%(name: string%): string buf[i] < 3 ) result[i] = buf[i]; else + { + result[i] = 0; break; + } } return new StringVal(result);