From 6522df7587eeacff1a91de29f9cf6d03f5401d59 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 25 Oct 2019 17:10:52 +0200 Subject: [PATCH] pkcs15: Avoid null dereference in fuzzers https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16617 --- src/libopensc/pkcs15.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libopensc/pkcs15.c b/src/libopensc/pkcs15.c index e313dcc8..68022697 100644 --- a/src/libopensc/pkcs15.c +++ b/src/libopensc/pkcs15.c @@ -2290,7 +2290,7 @@ sc_pkcs15_parse_unusedspace(const unsigned char *buf, size_t buflen, struct sc_p /* If the path length is 0, it's a dummy path then don't add it. * If the path length isn't included (-1) then it's against the standard * but we'll just ignore it instead of returning an error. */ - if (path.count > 0) { + if (path.count > 0 && p15card->file_app) { r = sc_pkcs15_make_absolute_path(&p15card->file_app->path, &path); if (r < 0) return r;