]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix a regression in X509_VERIFY_PARAM_add0_policy()
authorMatt Caswell <matt@openssl.org>
Thu, 27 Jul 2023 11:09:47 +0000 (12:09 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 31 Jul 2023 13:11:03 +0000 (14:11 +0100)
commite3d897d3fa3b48bb835fab0665a435469beea7ae
treef95245d7d774ec19b4c1b468bd770725ee9cf424
parent63fac76c2485c7c675fcbd5bc719c969c76ecc01
Fix a regression in X509_VERIFY_PARAM_add0_policy()

Also fixes a similar regression in X509_VERIFY_PARAM_add0_table().

Commit 38ebfc3 introduced a regression in 3.0.6 that changed the return
value of the two functions above from 1 on success to the number of entries
in the stack. If there are more than one entry then this is a change in
behaviour which should not have been introduced into a stable release.

This reverts the behaviour back to what it was prior to the change. The code
is slightly different to the original code in that we also handle a possible
-1 return value from the stack push function. This should never happen in
reality because we never pass a NULL stack as a parameter - but for the sake
of robustness we handle it anyway.

Note that the changed behaviour exists in all versions of 3.1 (it never had
the original version). But 3.1 should be fully backwards compatible with 3.0
so we should change it there too.

Fixes #21570

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/21576)
crypto/x509/x509_vpm.c