diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-04-29 09:36:02 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-04-29 09:36:49 +0200 |
commit | 83218f8c902232511e818cc0eb2d287bf9dea0ff (patch) | |
tree | 16adddd0c9cca3748f8d2478dc91a9e21e8783a5 | |
parent | 277453f078ee00a81083018b1e17f336633e78b0 (diff) | |
download | gnutls-83218f8c902232511e818cc0eb2d287bf9dea0ff.tar.gz |
_gnutls_hex2bin: refuse to decode odd-sized hex data
-rw-r--r-- | lib/str.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -513,6 +513,9 @@ _gnutls_hex2bin(const char *hex_data, size_t hex_size, uint8_t * bin_data, return GNUTLS_E_SHORT_MEMORY_BUFFER; } + if (i+1 >= hex_size) + return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); + hex2_data[0] = hex_data[i]; hex2_data[1] = hex_data[i + 1]; i += 2; |