]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix Edge Cases in Password Callback Handling
authorerbsland-dev <github@erbsland.dev>
Fri, 30 Aug 2024 08:56:58 +0000 (10:56 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 9 Sep 2024 06:58:53 +0000 (08:58 +0200)
commitf60bd9992d35ef81513fcc92bac027d5eda82cd7
treeb0afa3f62d518026c4410b08285fe600826716c7
parent750028cc51af1713aff815373e19807160b8d0b7
Fix Edge Cases in Password Callback Handling

Fixes #8441: Modify the password callback handling to reserve one byte in the buffer for a null terminator, ensuring compatibility with legacy behavior that puts a terminating null byte at the end.

Additionally, validate the length returned by the callback to ensure it does not exceed the given buffer size. If the returned length is too large, the process now stops gracefully with an appropriate error, enhancing robustness by preventing crashes from out-of-bounds access.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25330)

(cherry picked from commit 5387b71acb833f1f635ab4a20ced0863747ef5c1)
crypto/pem/pem_pk8.c
crypto/ui/ui_util.c