From c8b2e8271350ad3a5a4ebb5824f387b727d424f7 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 16 Nov 2020 13:55:04 +0100 Subject: [PATCH] oberthur: Once again, fix the error check The shared codition was executed but the condition in LOG_TEST_RET was not met in case of the acl was null. Thanks oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25962 --- src/libopensc/pkcs15-oberthur.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libopensc/pkcs15-oberthur.c b/src/libopensc/pkcs15-oberthur.c index f7e45347..29aab0b9 100644 --- a/src/libopensc/pkcs15-oberthur.c +++ b/src/libopensc/pkcs15-oberthur.c @@ -306,8 +306,15 @@ sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path, const struct sc_acl_entry *acl = sc_file_get_acl_entry(file, SC_AC_OP_READ); int ii; + if (acl == NULL) { + sc_file_free(file); + free(*out); + *out = NULL; + LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA); + } + rv = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH_PIN, objs, 0x10); - if (rv != SC_SUCCESS || acl == NULL) { + if (rv != SC_SUCCESS) { sc_file_free(file); free(*out); *out = NULL;