Fix pointer passed to provider_unquery_operation
authorPetr Gotthard <petr.gotthard@centrum.cz>
Sat, 15 May 2021 21:29:34 +0000 (23:29 +0200)
committerPauli <pauli@openssl.org>
Mon, 17 May 2021 00:22:27 +0000 (10:22 +1000)
Walking through the `map` modifies the pointer passed to the `unquery`
operation.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15295)

crypto/core_algorithm.c

index 50344fbe2dc7f22529b03b9314237acf6c918b7b..1a2e798c2c2d847413da99cb4a9ceb14afe69220 100644 (file)
@@ -59,11 +59,10 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata)
         map = ossl_provider_query_operation(provider, cur_operation,
                                             &no_store);
         if (map != NULL) {
-            while (map->algorithm_names != NULL) {
-                const OSSL_ALGORITHM *thismap = map++;
+            const OSSL_ALGORITHM *thismap;
 
+            for (thismap = map; thismap->algorithm_names != NULL; thismap++)
                 data->fn(provider, thismap, no_store, data->data);
-            }
         }
         ossl_provider_unquery_operation(provider, cur_operation, map);