diff options
author | inoguchi <> | 2021-08-28 05:30:09 +0000 |
---|---|---|
committer | inoguchi <> | 2021-08-28 05:30:09 +0000 |
commit | f2e03c16a5008f991492b26a1ee3e0e2ee47607f (patch) | |
tree | 98903bf1ee51c692122fc7e99a9c348a752dfb2d | |
parent | c317acb2df2cd1b6b91311917823f4ccb4c7c3df (diff) | |
download | openbsd-f2e03c16a5008f991492b26a1ee3e0e2ee47607f.tar.gz openbsd-f2e03c16a5008f991492b26a1ee3e0e2ee47607f.tar.bz2 openbsd-f2e03c16a5008f991492b26a1ee3e0e2ee47607f.zip |
Check X509_get_notAfter return value in openssl(1) ca.c
-rw-r--r-- | src/usr.bin/openssl/ca.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c index f7e3a73007..39e761633f 100644 --- a/src/usr.bin/openssl/ca.c +++ b/src/usr.bin/openssl/ca.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ca.c,v 1.40 2021/08/28 05:14:30 inoguchi Exp $ */ | 1 | /* $OpenBSD: ca.c,v 1.41 2021/08/28 05:30:09 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -2246,7 +2246,8 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | |||
2246 | /* We now just add it to the database */ | 2246 | /* We now just add it to the database */ |
2247 | row[DB_type] = malloc(2); | 2247 | row[DB_type] = malloc(2); |
2248 | 2248 | ||
2249 | tm = X509_get_notAfter(ret); | 2249 | if ((tm = X509_get_notAfter(ret)) == NULL) |
2250 | goto err; | ||
2250 | row[DB_exp_date] = strndup(tm->data, tm->length); | 2251 | row[DB_exp_date] = strndup(tm->data, tm->length); |
2251 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { | 2252 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { |
2252 | BIO_printf(bio_err, "Memory allocation failure\n"); | 2253 | BIO_printf(bio_err, "Memory allocation failure\n"); |
@@ -2503,7 +2504,8 @@ do_revoke(X509 *x509, CA_DB *db, int type, char *value) | |||
2503 | /* We now just add it to the database */ | 2504 | /* We now just add it to the database */ |
2504 | row[DB_type] = malloc(2); | 2505 | row[DB_type] = malloc(2); |
2505 | 2506 | ||
2506 | tm = X509_get_notAfter(x509); | 2507 | if ((tm = X509_get_notAfter(x509)) == NULL) |
2508 | goto err; | ||
2507 | row[DB_exp_date] = strndup(tm->data, tm->length); | 2509 | row[DB_exp_date] = strndup(tm->data, tm->length); |
2508 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { | 2510 | if (row[DB_type] == NULL || row[DB_exp_date] == NULL) { |
2509 | BIO_printf(bio_err, "Memory allocation failure\n"); | 2511 | BIO_printf(bio_err, "Memory allocation failure\n"); |