File gnutls-CVE-2015-3622.patch of Package gnutls.5070

From: Nikos Mavrogiannopoulos <nmav@redhat.com>
Date: Mon, 20 Apr 2015 14:56:27 +0200
Subject: [PATCH 1/1] _asn1_extract_der_octet: prevent past of boundary access

This version backported to 3.7 branch.

---
 lib/decoding.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Index: libtasn1-3.7/lib/minitasn1/decoding.c
===================================================================
--- libtasn1-3.7.orig/lib/minitasn1/decoding.c
+++ libtasn1-3.7/lib/minitasn1/decoding.c
@@ -676,6 +676,7 @@ _asn1_extract_der_octet (asn1_node node,
     return ASN1_DER_ERROR;
 
   counter = len3 + 1;
+  DECR_LEN(der_len, len3);
 
   if (len2 == -1)
     counter_end = der_len - 2;
@@ -684,6 +685,7 @@ _asn1_extract_der_octet (asn1_node node,
 
   while (counter < counter_end)
     {
+      DECR_LEN(der_len, 1);
       len2 = asn1_get_length_der (der + counter, der_len, &len3);
 
       if (len2 < -1)
@@ -705,7 +707,6 @@ _asn1_extract_der_octet (asn1_node node,
 	  len2 = 0;
 	}
 
-      DECR_LEN(der_len, 1);
       counter += len2 + len3 + 1;
     }
openSUSE Build Service is sponsored by