ossl_method_store_cache_get(): ensure non-NULL property query
authorRichard Levitte <levitte@openssl.org>
Thu, 18 Apr 2019 15:46:32 +0000 (17:46 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 19 Apr 2019 08:24:16 +0000 (10:24 +0200)
The comparator further down the call stack doesn't tolerate NULL, so
if we got that as input, use the empty string.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8781)

crypto/property/property.c

index 1a3d0c480d4439bdb62b09befd3acebbd7fd8738..a2122dc1bc7ecbdcbe7562a57f6512652b7449bf 100644 (file)
@@ -450,7 +450,7 @@ int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, int nid,
         return 0;
     }
 
         return 0;
     }
 
-    elem.query = prop_query;
+    elem.query = prop_query != NULL ? prop_query : "";
     r = lh_QUERY_retrieve(alg->cache, &elem);
     if (r == NULL) {
         ossl_property_unlock(store);
     r = lh_QUERY_retrieve(alg->cache, &elem);
     if (r == NULL) {
         ossl_property_unlock(store);