Fix conversion of nul-containing strings to binary.

Move key length checks to a common place.
This commit is contained in:
Michael R Sweet
2021-11-02 09:12:43 -04:00
parent af07f64bc3
commit 1e33878506
3 changed files with 14 additions and 11 deletions

View File

@@ -640,17 +640,13 @@ _pdfioCryptoUnlock(
}
else
{
if (length < 40 || length > 128)
length = 128; // Default to 128 bits
if (!strcmp(cfm, "V2"))
{
pdf->encryption = PDFIO_ENCRYPTION_RC4_128;
if (length < 40 || length > 128)
length = 128;
}
if (!strcmp(cfm, "AESV2"))
{
else if (!strcmp(cfm, "AESV2"))
pdf->encryption = PDFIO_ENCRYPTION_AES_128;
length = 128;
}
}
}
else if (version == 1 || version == 2)