Initial support for CRL path validation. This supports distinct certificate
[openssl.git] / crypto / asn1 / a_gentm.c
index ea8d7b96c876ff0ff2c08b3299dda98c726e2f95..9a9caafe8f8b68647ae5ee951e33467bf2765149 100644 (file)
@@ -117,8 +117,8 @@ err:
 
 int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
        {
-       static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
-       static int max[9]={99, 99,12,31,23,59,59,12,59};
+       static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
+       static const int max[9]={99, 99,12,31,23,59,59,12,59};
        char *a;
        int n,i,l,o;
 
@@ -176,6 +176,11 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
                        o++;
                        }
                }
+       else
+               {
+               /* Missing time zone information. */
+               goto err;
+               }
        return(o == l);
 err:
        return(0);
@@ -192,8 +197,9 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
                {
                if (s != NULL)
                        {
-                       ASN1_STRING_set((ASN1_STRING *)s,
-                               (unsigned char *)str,t.length);
+                       if (!ASN1_STRING_set((ASN1_STRING *)s,
+                               (unsigned char *)str,t.length))
+                               return 0;
                        s->type=V_ASN1_GENERALIZEDTIME;
                        }
                return(1);
@@ -223,7 +229,12 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
        if ((p == NULL) || ((size_t)s->length < len))
                {
                p=OPENSSL_malloc(len);
-               if (p == NULL) return(NULL);
+               if (p == NULL)
+                       {
+                       ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET,
+                               ERR_R_MALLOC_FAILURE);
+                       return(NULL);
+                       }
                if (s->data != NULL)
                        OPENSSL_free(s->data);
                s->data=(unsigned char *)p;