| Index: openssl/crypto/asn1/a_utctm.c
|
| ===================================================================
|
| --- openssl/crypto/asn1/a_utctm.c (revision 105093)
|
| +++ openssl/crypto/asn1/a_utctm.c (working copy)
|
| @@ -114,8 +114,8 @@
|
|
|
| int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
|
| {
|
| - static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
|
| - static int max[8]={99,12,31,23,59,59,12,59};
|
| + static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
|
| + static const int max[8]={99,12,31,23,59,59,12,59};
|
| char *a;
|
| int n,i,l,o;
|
|
|
| @@ -186,6 +186,12 @@
|
|
|
| ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
|
| {
|
| + return ASN1_UTCTIME_adj(s, t, 0, 0);
|
| + }
|
| +
|
| +ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
|
| + int offset_day, long offset_sec)
|
| + {
|
| char *p;
|
| struct tm *ts;
|
| struct tm data;
|
| @@ -200,13 +206,22 @@
|
| if (ts == NULL)
|
| return(NULL);
|
|
|
| + if (offset_day || offset_sec)
|
| + {
|
| + if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
|
| + return NULL;
|
| + }
|
| +
|
| + if((ts->tm_year < 50) || (ts->tm_year >= 150))
|
| + return NULL;
|
| +
|
| p=(char *)s->data;
|
| if ((p == NULL) || ((size_t)s->length < len))
|
| {
|
| p=OPENSSL_malloc(len);
|
| if (p == NULL)
|
| {
|
| - ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE);
|
| + ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
|
| return(NULL);
|
| }
|
| if (s->data != NULL)
|
|
|