diff options
author | jsing <> | 2015-10-22 14:10:55 +0000 |
---|---|---|
committer | jsing <> | 2015-10-22 14:10:55 +0000 |
commit | 030fbc721017350dbafec5fba71269472fe556c8 (patch) | |
tree | 8b55856380b4eeafdc0cd1508682cb66dd74371a | |
parent | 35b89b16434dea5e343c5b22feb4d46345c29330 (diff) | |
download | openbsd-030fbc721017350dbafec5fba71269472fe556c8.tar.gz openbsd-030fbc721017350dbafec5fba71269472fe556c8.tar.bz2 openbsd-030fbc721017350dbafec5fba71269472fe556c8.zip |
Extend tests to call ASN1_{GENERALIZED,UTC,}TIME_set_string() with a NULL
pointer - because, you know, you might want to set a string on a NULL
object. The previous implementation apparently allowed this as a way of
testing if the string was valid... probably because the *_check() functions
are only useable after the string has already been set.
-rw-r--r-- | src/regress/lib/libcrypto/asn1/asn1time.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/asn1/asn1time.c b/src/regress/lib/libcrypto/asn1/asn1time.c index 0334e49255..4db0f12769 100644 --- a/src/regress/lib/libcrypto/asn1/asn1time.c +++ b/src/regress/lib/libcrypto/asn1/asn1time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1time.c,v 1.5 2015/10/22 13:58:47 jsing Exp $ */ | 1 | /* $OpenBSD: asn1time.c,v 1.6 2015/10/22 14:10:55 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -236,6 +236,12 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
236 | int failure = 1; | 236 | int failure = 1; |
237 | int len; | 237 | int len; |
238 | 238 | ||
239 | if (ASN1_GENERALIZEDTIME_set_string(NULL, att->str) != 1) { | ||
240 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
241 | test_no, att->str); | ||
242 | goto done; | ||
243 | } | ||
244 | |||
239 | if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL) | 245 | if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL) |
240 | goto done; | 246 | goto done; |
241 | 247 | ||
@@ -293,6 +299,12 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att) | |||
293 | int failure = 1; | 299 | int failure = 1; |
294 | int len; | 300 | int len; |
295 | 301 | ||
302 | if (ASN1_UTCTIME_set_string(NULL, att->str) != 1) { | ||
303 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
304 | test_no, att->str); | ||
305 | goto done; | ||
306 | } | ||
307 | |||
296 | if ((ut = ASN1_UTCTIME_new()) == NULL) | 308 | if ((ut = ASN1_UTCTIME_new()) == NULL) |
297 | goto done; | 309 | goto done; |
298 | 310 | ||
@@ -347,6 +359,12 @@ asn1_time_test(int test_no, struct asn1_time_test *att, int type) | |||
347 | ASN1_TIME *t = NULL; | 359 | ASN1_TIME *t = NULL; |
348 | int failure = 1; | 360 | int failure = 1; |
349 | 361 | ||
362 | if (ASN1_TIME_set_string(NULL, att->str) != 1) { | ||
363 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
364 | test_no, att->str); | ||
365 | goto done; | ||
366 | } | ||
367 | |||
350 | if ((t = ASN1_TIME_new()) == NULL) | 368 | if ((t = ASN1_TIME_new()) == NULL) |
351 | goto done; | 369 | goto done; |
352 | 370 | ||