forked from soutade/libgourou
Fix a use after free in adept_activate : pass string destroyed too early
This commit is contained in:
parent
41f1a1e980
commit
479869b7f2
|
@ -1205,14 +1205,14 @@ namespace gourou
|
||||||
if ((*datasIt)->type() != uPDFParser::DataType::STREAM)
|
if ((*datasIt)->type() != uPDFParser::DataType::STREAM)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GOUROU_LOG(DEBUG, "Decrypt stream id " << object->objectId());
|
|
||||||
|
|
||||||
stream = (uPDFParser::Stream*) (*datasIt);
|
stream = (uPDFParser::Stream*) (*datasIt);
|
||||||
unsigned char* encryptedData = stream->data();
|
unsigned char* encryptedData = stream->data();
|
||||||
unsigned int dataLength = stream->dataLength();
|
unsigned int dataLength = stream->dataLength();
|
||||||
unsigned char* clearData = new unsigned char[dataLength];
|
unsigned char* clearData = new unsigned char[dataLength];
|
||||||
unsigned int dataOutLength;
|
unsigned int dataOutLength;
|
||||||
|
|
||||||
|
GOUROU_LOG(DEBUG, "Decrypt stream id " << object->objectId() << ", size " << stream->dataLength());
|
||||||
|
|
||||||
client->Decrypt(CryptoInterface::ALGO_RC4, CryptoInterface::CHAIN_ECB,
|
client->Decrypt(CryptoInterface::ALGO_RC4, CryptoInterface::CHAIN_ECB,
|
||||||
tmpKey, 16, /* Key */
|
tmpKey, 16, /* Key */
|
||||||
NULL, 0, /* IV */
|
NULL, 0, /* IV */
|
||||||
|
|
|
@ -289,11 +289,12 @@ int main(int argc, char** argv)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string pass;
|
||||||
if (!password)
|
if (!password)
|
||||||
{
|
{
|
||||||
char prompt[128];
|
char prompt[128];
|
||||||
std::snprintf(prompt, sizeof(prompt), "Enter password for <%s> : ", username);
|
std::snprintf(prompt, sizeof(prompt), "Enter password for <%s> : ", username);
|
||||||
std::string pass = getpass((const char*)prompt, false);
|
pass = getpass((const char*)prompt, false);
|
||||||
password = pass.c_str();
|
password = pass.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user