]> git.ipfire.org Git - thirdparty/openssl.git/commit
params: do not ignore zero-length strings
authorBenjamin Kaduk <bkaduk@akamai.com>
Thu, 21 May 2020 21:10:50 +0000 (14:10 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 28 May 2020 17:01:47 +0000 (10:01 -0700)
commit7c302f8afc1d36ec12effd0c08047baced095b46
tree5fffec04f2b5a7b69e6045ed8c7ce7cb1637c327
parent2cd3ebc76c7d8e76a8e337ef1eef43753eacef00
params: do not ignore zero-length strings

Prior to this commit, if a string (or octet string) parameter
was present but indicated it was zero-length, we would return success
but with a NULL output value.  This can be problematic in cases where
there is a protocol-level distinction between parameter-absent and
parameter-present-but-zero-length, which is uncommon but can happen.

Since OPENSSL_malloc() returns NULL for zero-length allocation requests,
make a dummy allocation for this case, to give a signal that the string
parameter does exist but has zero length.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11920)
crypto/params.c