utils: chunk_from_hex() skips optional 0x prefix

This commit is contained in:
Andreas Steffen
2017-03-06 18:54:09 +01:00
parent 2d41e1c51c
commit cfdccc93f5
2 changed files with 18 additions and 11 deletions
+7 -1
View File
@@ -504,7 +504,13 @@ chunk_t chunk_from_hex(chunk_t hex, char *buf)
u_char *ptr;
bool odd = FALSE;
/* subtract the number of optional ':' separation characters */
/* skip an optional 0x prefix */
if (hex.len > 1 && hex.ptr[1] == 'x' && hex.ptr[0] == '0')
{
hex = chunk_skip(hex, 2);
}
/* subtract the number of optional ':' separation characters */
len = hex.len;
ptr = hex.ptr;
for (i = 0; i < hex.len; i++)