Fix stack corruption in ui_read
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 13 May 2023 07:04:18 +0000 (09:04 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 17 May 2023 10:08:24 +0000 (12:08 +0200)
commit205e7e33a69f5d37887b3f80a8e529c929d23db8
tree7c38dad40fcb5eeccd7be2e3d4677b683f63b163
parent8847320dd6a7ac5d5915f8aa538d720cd98f8946
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)

(cherry picked from commit a64c48cff88e032cf9513578493c4536df725a22)
crypto/ui/ui_lib.c
crypto/ui/ui_util.c
test/evp_extra_test2.c