CRYPTO_mem_debug_push() and CRYPTO_mem_debug_pop() should return 0
authorMatt Caswell <matt@openssl.org>
Tue, 9 Aug 2022 10:59:22 +0000 (11:59 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 17 Aug 2022 10:58:43 +0000 (12:58 +0200)
Those 2 functions historically only ever returned 0 or 1. In OpenSSL 3.0
they were made no-ops and the documentation says they always return 0. In
fact they were returning -1. If any application was actually using these
functions then it may appear that they were actually successful (e.g. -1
could be interpreted as "true").

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18967)

(cherry picked from commit f868454257560c78570549f6a34d5918f03898a0)

crypto/mem.c

index 2cf240061af4f11a57bba8320939172e993a4eb5..f6cdcf5a423ec79ed4fff785788e315f5a5ead27 100644 (file)
@@ -285,12 +285,12 @@ int CRYPTO_set_mem_debug(int flag)
 int CRYPTO_mem_debug_push(const char *info, const char *file, int line)
 {
     (void)info; (void)file; (void)line;
-    return -1;
+    return 0;
 }
 
 int CRYPTO_mem_debug_pop(void)
 {
-    return -1;
+    return 0;
 }
 
 void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag,