The function X509_VERIFY_PARAM_add0_policy() is documented to implicitly enable the certificate policy check when doing certificate verification. However the implementation of the function does not enable the check which allows certificates with invalid or incorrect policies to pass the certificate verification. As suddenly enabling the policy check could break existing deployments it was decided to keep the existing behavior of the X509_VERIFY_PARAM_add0_policy() function. Instead the applications that require OpenSSL to perform certificate policy check need to use X509_VERIFY_PARAM_set1_policies() or explicitly enable the policy check by calling X509_VERIFY_PARAM_set_flags() with the X509_V_FLAG_POLICY_CHECK flag argument. Certificate policy checks are disabled by default in OpenSSL and are not commonly used by applications.
https://www.cisa.gov/news-events/ics-advisories/icsa-24-165-11
https://www.cisa.gov/news-events/ics-advisories/icsa-24-165-10
https://www.cisa.gov/news-events/ics-advisories/icsa-24-165-06
https://www.cisa.gov/news-events/ics-advisories/icsa-24-165-04
https://cert-portal.siemens.com/productcert/html/ssa-556635.html
https://www.openssl.org/news/secadv/20230328.txt
https://www.debian.org/security/2023/dsa-5417
https://security.netapp.com/advisory/ntap-20230414-0001/
https://security.gentoo.org/glsa/202402-08
https://lists.debian.org/debian-lts-announce/2023/06/msg00011.html