summaryrefslogtreecommitdiff
path: root/lib/str.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-04-29 09:36:02 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-04-29 09:36:49 +0200
commit83218f8c902232511e818cc0eb2d287bf9dea0ff (patch)
tree16adddd0c9cca3748f8d2478dc91a9e21e8783a5 /lib/str.c
parent277453f078ee00a81083018b1e17f336633e78b0 (diff)
downloadgnutls-83218f8c902232511e818cc0eb2d287bf9dea0ff.tar.gz
_gnutls_hex2bin: refuse to decode odd-sized hex data
Diffstat (limited to 'lib/str.c')
-rw-r--r--lib/str.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/str.c b/lib/str.c
index 7a04c78985..dbe8feffc4 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -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;