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