|
|
@@ -224,24 +224,29 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, |
|
|
|
struct tm *ts; |
|
|
|
struct tm data; |
|
|
|
size_t len = 20; |
|
|
|
int free_s = 0; |
|
|
|
|
|
|
|
if (s == NULL) |
|
|
|
{ |
|
|
|
free_s = 1; |
|
|
|
s=M_ASN1_UTCTIME_new(); |
|
|
|
} |
|
|
|
if (s == NULL) |
|
|
|
return(NULL); |
|
|
|
goto err; |
|
|
|
|
|
|
|
|
|
|
|
ts=OPENSSL_gmtime(&t, &data); |
|
|
|
if (ts == NULL) |
|
|
|
return(NULL); |
|
|
|
goto err; |
|
|
|
|
|
|
|
if (offset_day || offset_sec) |
|
|
|
{ |
|
|
|
if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) |
|
|
|
return NULL; |
|
|
|
goto err; |
|
|
|
} |
|
|
|
|
|
|
|
if((ts->tm_year < 50) || (ts->tm_year >= 150)) |
|
|
|
return NULL; |
|
|
|
goto err; |
|
|
|
|
|
|
|
p=(char *)s->data; |
|
|
|
if ((p == NULL) || ((size_t)s->length < len)) |
|
|
@@ -250,7 +255,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, |
|
|
|
if (p == NULL) |
|
|
|
{ |
|
|
|
OPENSSL_PUT_ERROR(ASN1, ASN1_UTCTIME_adj, ERR_R_MALLOC_FAILURE); |
|
|
|
return(NULL); |
|
|
|
goto err; |
|
|
|
} |
|
|
|
if (s->data != NULL) |
|
|
|
OPENSSL_free(s->data); |
|
|
@@ -262,6 +267,10 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, |
|
|
|
s->length=strlen(p); |
|
|
|
s->type=V_ASN1_UTCTIME; |
|
|
|
return(s); |
|
|
|
err: |
|
|
|
if (free_s && s) |
|
|
|
M_ASN1_UTCTIME_free(s); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|