summaryrefslogtreecommitdiff
path: root/lib/minitasn1
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-09-15 16:05:33 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-09-15 16:05:33 +0200
commitb94d58f1bf2e10762017a780c35d0e44d50a4a64 (patch)
tree4af192c528565e44e59a9338e7ecd1835e713648 /lib/minitasn1
parent1e86b780a430dc7324e2a801e24293fc8a885216 (diff)
downloadgnutls-b94d58f1bf2e10762017a780c35d0e44d50a4a64.tar.gz
updated libtasn1
Diffstat (limited to 'lib/minitasn1')
-rw-r--r--lib/minitasn1/decoding.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c
index 0b5bd104e7..e206b93a25 100644
--- a/lib/minitasn1/decoding.c
+++ b/lib/minitasn1/decoding.c
@@ -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;