]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
updated libtasn1
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 15 Sep 2014 14:05:33 +0000 (16:05 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 15 Sep 2014 14:05:33 +0000 (16:05 +0200)
lib/minitasn1/decoding.c

index 0b5bd104e73f6896853854bda78e162b542c9c7e..e206b93a250e655d7ae46a273fca4ac7fe27664b 100644 (file)
@@ -302,41 +302,43 @@ _asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *r
       return ASN1_DER_ERROR;
     }
 
-  p = &der[len_len];
-  for (i=0;i<str_len-1;i++)
-     {
-       if (isdigit(p[i]) == 0)
+  if (flags & ASN1_DECODE_FLAG_STRICT_DER)
+    {
+      p = &der[len_len];
+      for (i=0;i<(unsigned)(str_len-1);i++)
          {
-           if (type == ASN1_ETYPE_GENERALIZED_TIME)
+           if (isdigit(p[i]) == 0)
              {
-               /* tolerate lax encodings */
-               if (p[i] == '.' && dot_count == 0)
+               if (type == ASN1_ETYPE_GENERALIZED_TIME)
                  {
-                   dot_count++;
-                   continue;
+                   /* tolerate lax encodings */
+                   if (p[i] == '.' && dot_count == 0)
+                     {
+                       dot_count++;
+                       continue;
+                     }
+
+               /* This is not really valid DER, but there are
+                * structures using that */
+                   if (!(flags & ASN1_DECODE_FLAG_STRICT_DER) &&
+                       (p[i] == '+' || p[i] == '-') && sign_count == 0)
+                     {
+                       sign_count++;
+                       continue;
+                     }
                  }
 
-              /* This is not really valid DER, but there are
-               * structures using that */
-               if (!(flags & ASN1_DECODE_FLAG_STRICT_DER) &&
-                   (p[i] == '+' || p[i] == '-') && sign_count == 0)
-                 {
-                   sign_count++;
-                   continue;
-                 }
+               warn();
+           return ASN1_DER_ERROR;
              }
-
-           warn();
-          return ASN1_DER_ERROR;
          }
-     }
 
-  if (sign_count == 0 && p[str_len-1] != 'Z')
-    {
-      warn();
-      return ASN1_DER_ERROR;
+      if (sign_count == 0 && p[str_len-1] != 'Z')
+        {
+          warn();
+          return ASN1_DER_ERROR;
+        }
     }
-
   memcpy (str, der + len_len, str_len);
   str[str_len] = 0;
   *ret_len = str_len + len_len;