105 lines
3.4 KiB
Diff
105 lines
3.4 KiB
Diff
# HG changeset patch
|
|
# User Alexander Sosedkin <asosedkin@redhat.com>
|
|
# Date 1758314824 0
|
|
# Node ID 5cd6a78cccd3e47d5097d1266bc809bb910fa019
|
|
# Parent 08d99cad107fb6686c58b8659036b82c88d7681e
|
|
Bug 1980465 - Fix a big-endian-problematic cast in zlib calls. r=nkulatova
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D259453
|
|
|
|
diff --git a/cmd/selfserv/selfserv.c b/cmd/selfserv/selfserv.c
|
|
--- a/cmd/selfserv/selfserv.c
|
|
+++ b/cmd/selfserv/selfserv.c
|
|
@@ -2112,19 +2112,19 @@ zlibCertificateDecode(const SECItem *inp
|
|
unsigned char *output, size_t outputLen,
|
|
size_t *usedLen)
|
|
{
|
|
if (!input || !input->data || input->len == 0 || !output || outputLen == 0) {
|
|
PR_SetError(SEC_ERROR_INVALID_ARGS, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
- *usedLen = outputLen;
|
|
-
|
|
- int ret = uncompress(output, (unsigned long *)usedLen, input->data, input->len);
|
|
+ unsigned long outputLenUL = outputLen;
|
|
+ int ret = uncompress(output, &outputLenUL, input->data, input->len);
|
|
+ *usedLen = outputLenUL;
|
|
if (ret != Z_OK) {
|
|
PR_SetError(SEC_ERROR_BAD_DATA, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
return SECSuccess;
|
|
}
|
|
|
|
@@ -2134,17 +2134,19 @@ zlibCertificateEncode(const SECItem *inp
|
|
if (!input || !input->data || input->len == 0 || !output) {
|
|
PR_SetError(SEC_ERROR_INVALID_ARGS, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
unsigned long maxCompressedLen = compressBound(input->len);
|
|
SECITEM_AllocItem(NULL, output, maxCompressedLen);
|
|
|
|
- int ret = compress(output->data, (unsigned long *)&output->len, input->data, input->len);
|
|
+ unsigned long outputLenUL = output->len;
|
|
+ int ret = compress(output->data, &outputLenUL, input->data, input->len);
|
|
+ output->len = outputLenUL;
|
|
if (ret != Z_OK) {
|
|
PR_SetError(SEC_ERROR_LIBRARY_FAILURE, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
return SECSuccess;
|
|
}
|
|
|
|
diff --git a/cmd/tstclnt/tstclnt.c b/cmd/tstclnt/tstclnt.c
|
|
--- a/cmd/tstclnt/tstclnt.c
|
|
+++ b/cmd/tstclnt/tstclnt.c
|
|
@@ -1366,17 +1366,19 @@ zlibCertificateEncode(const SECItem *inp
|
|
if (!input || !input->data || input->len == 0 || !output) {
|
|
PR_SetError(SEC_ERROR_INVALID_ARGS, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
unsigned long maxCompressedLen = compressBound(input->len);
|
|
SECITEM_AllocItem(NULL, output, maxCompressedLen);
|
|
|
|
- int ret = compress(output->data, (unsigned long *)&output->len, input->data, input->len);
|
|
+ unsigned long outputLenUL = output->len;
|
|
+ int ret = compress(output->data, &outputLenUL, input->data, input->len);
|
|
+ output->len = outputLenUL;
|
|
if (ret != Z_OK) {
|
|
PR_SetError(SEC_ERROR_LIBRARY_FAILURE, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
return SECSuccess;
|
|
}
|
|
|
|
@@ -1385,19 +1387,19 @@ zlibCertificateDecode(const SECItem *inp
|
|
unsigned char *output, size_t outputLen,
|
|
size_t *usedLen)
|
|
{
|
|
if (!input || !input->data || input->len == 0 || !output || outputLen == 0) {
|
|
PR_SetError(SEC_ERROR_INVALID_ARGS, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
- *usedLen = outputLen;
|
|
-
|
|
- int ret = uncompress(output, (unsigned long *)usedLen, input->data, input->len);
|
|
+ unsigned long outputLenUL = outputLen;
|
|
+ int ret = uncompress(output, &outputLenUL, input->data, input->len);
|
|
+ *usedLen = outputLenUL;
|
|
if (ret != Z_OK) {
|
|
PR_SetError(SEC_ERROR_BAD_DATA, 0);
|
|
return SECFailure;
|
|
}
|
|
|
|
return SECSuccess;
|
|
}
|
|
|
|
|