Blame SOURCES/nss-3.79-pkcs12-fix-null-password.patch

87e872
diff -up ./lib/pkcs12/p12local.c.fix_null_password ./lib/pkcs12/p12local.c
87e872
--- ./lib/pkcs12/p12local.c.fix_null_password	2022-07-20 14:15:45.081009438 -0700
87e872
+++ ./lib/pkcs12/p12local.c	2022-07-20 14:19:40.856546963 -0700
87e872
@@ -968,15 +968,14 @@ sec_pkcs12_convert_item_to_unicode(PLAre
87e872
     if (zeroTerm) {
87e872
         /* unicode adds two nulls at the end */
87e872
         if (toUnicode) {
87e872
-            if ((dest->len >= 2) &&
87e872
-                (dest->data[dest->len - 1] || dest->data[dest->len - 2])) {
87e872
+            if ((dest->len < 2) || dest->data[dest->len - 1] || dest->data[dest->len - 2]) {
87e872
                 /* we've already allocated space for these new NULLs */
87e872
                 PORT_Assert(dest->len + 2 <= bufferSize);
87e872
                 dest->len += 2;
87e872
                 dest->data[dest->len - 1] = dest->data[dest->len - 2] = 0;
87e872
             }
87e872
             /* ascii/utf-8 adds just 1 */
87e872
-        } else if ((dest->len >= 1) && dest->data[dest->len - 1]) {
87e872
+        } else if (!dest->len || dest->data[dest->len - 1]) {
87e872
             PORT_Assert(dest->len + 1 <= bufferSize);
87e872
             dest->len++;
87e872
             dest->data[dest->len - 1] = 0;