summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-01-30 11:15:13 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-01-30 12:33:24 +0100
commit6613833fd917f0712bdc354590f47cf341aa7691 (patch)
tree1cf1a9178ee619005744e910845f285c9fcb4148
parent55066ae68d6b43a3fa16caefb2904ead47f6fe6e (diff)
downloadgnutls-6613833fd917f0712bdc354590f47cf341aa7691.tar.gz
Revert "Fix out-of-bounds read in gnutls_x509_ext_export_key_usage"
This was not really an out-of-bounds check. Added documentation to make that clear. This reverts commit ffbc9aaea7dcf29c03784d128b83f0682357858d.
-rw-r--r--lib/x509/x509_ext.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/x509/x509_ext.c b/lib/x509/x509_ext.c
index 2227056722..2cd9640541 100644
--- a/lib/x509/x509_ext.c
+++ b/lib/x509/x509_ext.c
@@ -1125,7 +1125,9 @@ int gnutls_x509_ext_export_key_usage(unsigned int usage, gnutls_datum_t * ext)
str[0] = usage & 0xff;
str[1] = usage >> 8;
- result = asn1_write_value(c2, "", str, 2);
+ /* Since KeyUsage is a BIT STRING, the input to asn1_write_value
+ * is the number of bits to be read. */
+ result = asn1_write_value(c2, "", str, 9);
if (result != ASN1_SUCCESS) {
gnutls_assert();
asn1_delete_structure(&c2);