Fix ASN1_TIME_to_generlizedtime().
[openssl.git] / crypto / asn1 / a_time.c
index 03788a7d62a67ccba0709d306b0295c26efc78ba..4c6b37ba06201a5a358682ed927cd54d68c5296c 100644 (file)
@@ -149,9 +149,9 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
        /* grow the string */
        if (!ASN1_STRING_set(ret, NULL, t->length + 2))
                return NULL;
+       str = (char *)ret->data;
        /* Work out the century and prepend */
-       str = (char *)t->data;
-       if (*str >= '5') strcpy(str, "19");
+       if (t->data[0] >= '5') strcpy(str, "19");
        else strcpy(str, "20");
 
        strcat(str, (char *)t->data);