Null-terminate the string created by decode_netbios_name BiF.

(initially observed through failures of bifs.netbios-functions unit test)
This commit is contained in:
Jon Siwek 2011-06-10 12:59:05 -05:00
parent 13c90fc732
commit d358ef1e71

View file

@ -1348,7 +1348,7 @@ function fmt_ftp_port%(a: addr, p: port%): string
function decode_netbios_name%(name: string%): string function decode_netbios_name%(name: string%): string
%{ %{
char buf[16]; char buf[16];
char result[32]; char result[16];
const u_char* s = name->Bytes(); const u_char* s = name->Bytes();
int i, j; int i, j;
@ -1367,8 +1367,11 @@ function decode_netbios_name%(name: string%): string
buf[i] < 3 ) buf[i] < 3 )
result[i] = buf[i]; result[i] = buf[i];
else else
{
result[i] = 0;
break; break;
} }
}
return new StringVal(result); return new StringVal(result);
%} %}