Fix error check on default_check() helper function
authorndossche <niels.dossche@ugent.be>
Mon, 30 Jan 2023 14:24:01 +0000 (15:24 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 8 Feb 2023 15:56:20 +0000 (16:56 +0100)
default_check() can return a zero value to indicate an internal error in
one condition for the PRE_CTRL_STR_TO_PARAMS state. This state can be
reached from the default_fixup_args() function which does not check for
a zero value. All other callers of default_check() in that file do check
for a zero return value. Fix it by changing the check to <= 0.

CLA: trivial

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

crypto/evp/ctrl_params_translate.c

index f64c1fcb2acaccb9d01d02c54e4202cb36874cf6..a3db7aed34861e3ea10187985cfc4c0f9ad6ffd2 100644 (file)
@@ -387,7 +387,7 @@ static int default_fixup_args(enum state state,
 {
     int ret;
 
-    if ((ret = default_check(state, translation, ctx)) < 0)
+    if ((ret = default_check(state, translation, ctx)) <= 0)
         return ret;
 
     switch (state) {