blob: 620f8a34969f5f7aa1f41ddf0fa188d99855fd6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
--- kpdf/xpdf/Decrypt.cc.jn 2002-12-06 00:44:32.000000000 +0100
+++ kpdf/xpdf/Decrypt.cc 2005-01-14 13:38:48.192647128 +0100
@@ -132,13 +132,19 @@ GBool Decrypt::makeFileKey2(int encVersi
Guchar *buf;
Guchar test[32];
Guchar fState[256];
- Guchar tmpKey[16];
+ Guchar *tmpKey;
Guchar fx, fy;
int len, i, j;
GBool ok;
+ // check whether we have non-zero keyLength
+ if ( !keyLength ) {
+ return gFalse;
+ }
+
// generate file key
buf = (Guchar *)gmalloc(68 + fileID->getLength());
+ tmpKey = (Guchar *)gmalloc(keyLength * sizeof(Guchar));
if (userPassword) {
len = userPassword->getLength();
if (len < 32) {
@@ -191,6 +197,7 @@ GBool Decrypt::makeFileKey2(int encVersi
ok = gFalse;
}
+ gfree(tmpKey);
gfree(buf);
return ok;
}
|