md5: Return a NULL pointer if MD5::raw_digest() is called early
This never happens since MD5::raw_digest()'s only caller, util::md5(), always does it right. However, it's still an open invitation for someone to read garbage past the end of a 1 byte array, or even worse, write into it. I'd rather have us crash by dereferencing the null page in that case instead.
This commit is contained in:
parent
7be7e3ce8c
commit
fbe7a58c6f
1 changed files with 1 additions and 1 deletions
|
@ -163,7 +163,7 @@ MD5::uint1 *MD5::raw_digest()
|
|||
if (!finalized){
|
||||
std::cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
||||
"finalized the digest!" <<std::endl;
|
||||
return ( const_cast<uint1*>(reinterpret_cast<const uint1*>("")));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(s, digest, 16);
|
||||
|
|
Loading…
Add table
Reference in a new issue