diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_gentm.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_gentm.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c index 54016dc8e7..2ef6e6bc22 100644 --- a/src/lib/libcrypto/asn1/a_gentm.c +++ b/src/lib/libcrypto/asn1/a_gentm.c | |||
@@ -116,8 +116,7 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | |||
116 | * field so make first two fields 00 to 99 | 116 | * field so make first two fields 00 to 99 |
117 | */ | 117 | */ |
118 | if (l < 13) goto err; | 118 | if (l < 13) goto err; |
119 | for (i=0; i<7; i++) | 119 | for (i=0; i<7; i++) { |
120 | { | ||
121 | if ((i == 6) && ((a[o] == 'Z') || | 120 | if ((i == 6) && ((a[o] == 'Z') || |
122 | (a[o] == '+') || (a[o] == '-'))) | 121 | (a[o] == '+') || (a[o] == '-'))) |
123 | { i++; break; } | 122 | { i++; break; } |
@@ -146,12 +145,10 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | |||
146 | 145 | ||
147 | if (a[o] == 'Z') | 146 | if (a[o] == 'Z') |
148 | o++; | 147 | o++; |
149 | else if ((a[o] == '+') || (a[o] == '-')) | 148 | else if ((a[o] == '+') || (a[o] == '-')) { |
150 | { | ||
151 | o++; | 149 | o++; |
152 | if (o+4 > l) goto err; | 150 | if (o+4 > l) goto err; |
153 | for (i=7; i<9; i++) | 151 | for (i=7; i<9; i++) { |
154 | { | ||
155 | if ((a[o] < '0') || (a[o] > '9')) goto err; | 152 | if ((a[o] < '0') || (a[o] > '9')) goto err; |
156 | n= a[o]-'0'; | 153 | n= a[o]-'0'; |
157 | o++; | 154 | o++; |
@@ -160,9 +157,7 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | |||
160 | if ((n < min[i]) || (n > max[i])) goto err; | 157 | if ((n < min[i]) || (n > max[i])) goto err; |
161 | o++; | 158 | o++; |
162 | } | 159 | } |
163 | } | 160 | } else { |
164 | else | ||
165 | { | ||
166 | /* Missing time zone information. */ | 161 | /* Missing time zone information. */ |
167 | goto err; | 162 | goto err; |
168 | } | 163 | } |
@@ -178,10 +173,8 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) | |||
178 | t.type=V_ASN1_GENERALIZEDTIME; | 173 | t.type=V_ASN1_GENERALIZEDTIME; |
179 | t.length=strlen(str); | 174 | t.length=strlen(str); |
180 | t.data=(unsigned char *)str; | 175 | t.data=(unsigned char *)str; |
181 | if (ASN1_GENERALIZEDTIME_check(&t)) | 176 | if (ASN1_GENERALIZEDTIME_check(&t)) { |
182 | { | 177 | if (s != NULL) { |
183 | if (s != NULL) | ||
184 | { | ||
185 | if (!ASN1_STRING_set((ASN1_STRING *)s, | 178 | if (!ASN1_STRING_set((ASN1_STRING *)s, |
186 | (unsigned char *)str,t.length)) | 179 | (unsigned char *)str,t.length)) |
187 | return 0; | 180 | return 0; |
@@ -216,18 +209,15 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | |||
216 | if (ts == NULL) | 209 | if (ts == NULL) |
217 | return(NULL); | 210 | return(NULL); |
218 | 211 | ||
219 | if (offset_day || offset_sec) | 212 | if (offset_day || offset_sec) { |
220 | { | ||
221 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) | 213 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) |
222 | return NULL; | 214 | return NULL; |
223 | } | 215 | } |
224 | 216 | ||
225 | p=(char *)s->data; | 217 | p=(char *)s->data; |
226 | if ((p == NULL) || ((size_t)s->length < len)) | 218 | if ((p == NULL) || ((size_t)s->length < len)) { |
227 | { | ||
228 | p=malloc(len); | 219 | p=malloc(len); |
229 | if (p == NULL) | 220 | if (p == NULL) { |
230 | { | ||
231 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, | 221 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, |
232 | ERR_R_MALLOC_FAILURE); | 222 | ERR_R_MALLOC_FAILURE); |
233 | return(NULL); | 223 | return(NULL); |