Commit 83ef843d92 for openssl.org
commit 83ef843d92ef8ffc953aca4d450e9fc586c470e9
Author: Bob Beck <beck@openssl.org>
Date: Thu Apr 30 13:41:32 2026 -0600
Guard memcmp for ub in X509_vpm.c
Techincally unnecessary, since this thing won't let you add NULL
data to it, but this is harmless and then obviously following
the correct paradigm.
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat May 2 18:05:04 2026
(Merged from https://github.com/openssl/openssl/pull/31049)
diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c
index aa606f6320..bc2eb2cce1 100644
--- a/crypto/x509/x509_vpm.c
+++ b/crypto/x509/x509_vpm.c
@@ -110,6 +110,8 @@ static int buffer_cmp(const X509_BUFFER *const *a, const X509_BUFFER *const *b)
return -1;
if ((*a)->len > (*b)->len)
return 1;
+ if ((*b)->len == 0)
+ return 0;
return memcmp((*a)->data, (*b)->data, (*b)->len);
}