]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
uni2utf8: reject negative length like uni2asc
authorrootvector2 <dxbnaveed.k@gmail.com>
Wed, 3 Jun 2026 18:28:39 +0000 (23:58 +0530)
committerNorbert Pocs <norbertp@openssl.org>
Thu, 11 Jun 2026 08:56:32 +0000 (10:56 +0200)
Reviewed-by: Alicja Kario <hkario@redhat.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jun 11 08:56:39 2026
(Merged from https://github.com/openssl/openssl/pull/31378)

crypto/pkcs12/p12_utl.c

index c864c9c9aad0c0f0bda017b174737629ff363e2f..3c19f727a1b9c9959e86bd664cd36b1fc42a8482 100644 (file)
@@ -188,6 +188,8 @@ char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen)
     /* string must contain an even number of bytes */
     if (unilen & 1)
         return NULL;
+    if (unilen < 0)
+        return NULL;
 
     for (asclen = 0, i = 0; i < unilen;) {
         j = bmp_to_utf8(NULL, uni + i, unilen - i);