Ensure that the input to strtoul ends with a null.

Otherwise it runs past the end of the array into stack memory. Should fix the
intermittent DVB-CI decryption test suite failures.

Change-Id: Ice17497e661c8579baf3a546efcb5529beda6b49
Reviewed-on: https://code.wireshark.org/review/559
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
Evan Huus 2014-03-08 10:43:39 -05:00 committed by Martin Kaiser
parent ddd9d274b9
commit ed1528d339
1 changed files with 2 additions and 1 deletions

View File

@ -2180,7 +2180,7 @@ pref_key_string_to_bin(const gchar *key_string, unsigned char **key_bin)
{
int key_string_len;
int i, j;
char input[2];
char input[3];
if (!key_string || !key_bin)
return -1;
@ -2188,6 +2188,7 @@ pref_key_string_to_bin(const gchar *key_string, unsigned char **key_bin)
if (key_string_len != 2*AES_KEY_LEN)
return -1;
*key_bin = (unsigned char*)g_malloc(key_string_len/2);
input[2] = '\0';
j=0;
for (i=0; i<key_string_len-1; i+=2) {