summaryrefslogtreecommitdiff
path: root/crypto/ui/ui_lib.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2023-05-13 09:04:18 +0200
committerTomas Mraz <tomas@openssl.org>2023-05-17 12:07:02 +0200
commita64c48cff88e032cf9513578493c4536df725a22 (patch)
tree303a52f0ae1ee45ce56f59d23cbacfeb01542472 /crypto/ui/ui_lib.c
parent43d5dac9d00ac486823d949f85ee3ad650b62af8 (diff)
downloadopenssl-new-a64c48cff88e032cf9513578493c4536df725a22.tar.gz
Fix stack corruption in ui_read
This is an alternative to #20893 Additionally this fixes also a possible issue in UI_UTIL_read_pw: When UI_new returns NULL, the result code would still be zero as if UI_UTIL_read_pw succeeded, but the password buffer is left uninitialized, with subsequent possible stack corruption or worse. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20957)
Diffstat (limited to 'crypto/ui/ui_lib.c')
-rw-r--r--crypto/ui/ui_lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c
index 9c779df48d..859557a0a4 100644
--- a/crypto/ui/ui_lib.c
+++ b/crypto/ui/ui_lib.c
@@ -508,6 +508,10 @@ int UI_process(UI *ui)
ok = 0;
break;
}
+ } else {
+ ui->flags &= ~UI_FLAG_REDOABLE;
+ ok = -2;
+ goto err;
}
}