]> git.ipfire.org Git - thirdparty/openssl.git/commit
Don't promise a non-zero return size in error cases.
authorViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 16 Jan 2025 08:45:50 +0000 (19:45 +1100)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Tue, 21 Jan 2025 06:21:52 +0000 (17:21 +1100)
commit1dafff06ca6a3c263e5e6222b92c6fbdbf31b8fe
treeab654f9e505c8d06c9c2519587a5da92aeb0d0ab
parent35f6e7ea02b599d5aaf220b4720cbadd946d8023
Don't promise a non-zero return size in error cases.

When a requested parameter has a non-NULL result pointer,
and the error isn't simply that the result buffer is too
small, don't return a non-zero result size.

Returning a non-zero result size that isn't larger than the
user's provided space is an indication that a result of
that size was actually written, inviting trouble if the
error indication was inadvertenly lost.

Also, in such cases (wrong type, data can't be converted to the
requested type when otherwise supported, ...) there is nothing useful to
be done with the return size value, it can't help to address the
problem.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/26436)
crypto/params.c