NCP2222: fix possible buffer-overflow

Caught by ASAN (thanks Alexis!)

Change-Id: Ibbe2c405ba1a3ba0d5a5b9ffff9e95282526028b
Reviewed-on: https://code.wireshark.org/review/6652
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Evan Huus 2015-01-19 11:55:01 -05:00 committed by Anders Broman
parent 1af7b97927
commit f3cbee6aab
1 changed files with 5 additions and 1 deletions

View File

@ -2527,7 +2527,11 @@ uni_to_string(char * data, guint32 str_length, char *dest_buf)
if(length_remaining==0)
{
dest_buf[i+1] = '\0';
if (i+1 < (gint)str_length){
dest_buf[i+1] = '\0';
} else {
dest_buf[i] = '\0';
}
return;
}
}