Skip to content

Commit e3f0362

Browse files
PeiweiHut8m
authored andcommitted
BIO_read_filename: fix return check
Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from openssl#17033)
1 parent bf4ceed commit e3f0362

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ssl/ssl_cert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file_ex(const char *file,
625625
ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
626626
goto err;
627627
}
628-
if (!BIO_read_filename(in, file))
628+
if (BIO_read_filename(in, file) <= 0)
629629
goto err;
630630

631631
/* Internally lh_X509_NAME_retrieve() needs the libctx to retrieve SHA1 */
@@ -696,7 +696,7 @@ int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
696696
goto err;
697697
}
698698

699-
if (!BIO_read_filename(in, file))
699+
if (BIO_read_filename(in, file) <= 0)
700700
goto err;
701701

702702
for (;;) {

test/sslapitest.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7994,21 +7994,21 @@ static int cert_cb(SSL *s, void *arg)
79947994
if (!TEST_ptr(chain))
79957995
goto out;
79967996
if (!TEST_ptr(in = BIO_new(BIO_s_file()))
7997-
|| !TEST_int_ge(BIO_read_filename(in, rootfile), 0)
7997+
|| !TEST_int_gt(BIO_read_filename(in, rootfile), 0)
79987998
|| !TEST_ptr(rootx = X509_new_ex(libctx, NULL))
79997999
|| !TEST_ptr(PEM_read_bio_X509(in, &rootx, NULL, NULL))
80008000
|| !TEST_true(sk_X509_push(chain, rootx)))
80018001
goto out;
80028002
rootx = NULL;
80038003
BIO_free(in);
80048004
if (!TEST_ptr(in = BIO_new(BIO_s_file()))
8005-
|| !TEST_int_ge(BIO_read_filename(in, ecdsacert), 0)
8005+
|| !TEST_int_gt(BIO_read_filename(in, ecdsacert), 0)
80068006
|| !TEST_ptr(x509 = X509_new_ex(libctx, NULL))
80078007
|| !TEST_ptr(PEM_read_bio_X509(in, &x509, NULL, NULL)))
80088008
goto out;
80098009
BIO_free(in);
80108010
if (!TEST_ptr(in = BIO_new(BIO_s_file()))
8011-
|| !TEST_int_ge(BIO_read_filename(in, ecdsakey), 0)
8011+
|| !TEST_int_gt(BIO_read_filename(in, ecdsakey), 0)
80128012
|| !TEST_ptr(pkey = PEM_read_bio_PrivateKey_ex(in, NULL,
80138013
NULL, NULL,
80148014
libctx, NULL)))

0 commit comments

Comments
 (0)