We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae09808 commit b971686Copy full SHA for b971686
1 file changed
pdfgen.c
@@ -2138,7 +2138,8 @@ static void pdf_crypt_pad_password(const char *pwd, uint8_t out[32])
2138
plen = 32;
2139
if (pwd && plen > 0)
2140
memcpy(out, pwd, plen);
2141
- memcpy(out + plen, pdf_crypt_padding, 32 - plen);
+ if (plen < 32)
2142
+ memcpy(out + plen, pdf_crypt_padding, 32 - plen);
2143
}
2144
2145
/*
@@ -2203,8 +2204,6 @@ static size_t pdf_crypt_object_key(const struct pdf_crypt *crypt,
2203
2204
uint8_t md5_out[16];
2205
pdf_md5(key_in, sizeof(key_in), md5_out);
2206
size_t keylen = PDF_CRYPT_KEY_LEN + 5; /* min(n+5, 16) = 10 for 40-bit */
- if (keylen > 16)
2207
- keylen = 16;
2208
memcpy(out_key, md5_out, keylen);
2209
return keylen;
2210
0 commit comments