mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 04:14:27 -04:00
Fixed possible fread from a null pointer in HashCache.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8476 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
25acecdf93
commit
b6e0f7c5a4
1 changed files with 6 additions and 1 deletions
|
@ -136,7 +136,12 @@ HashCache::HashCache(const std::string& path)
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
FILE *F = fopen( (_path+".bin").c_str(),"rb") ;
|
FILE *F = fopen( (_path+".bin").c_str(),"rb") ;
|
||||||
|
if (!F)
|
||||||
|
{
|
||||||
|
std::cerr << "Cannot open file for reading encrypted file cache, filename " << (_path+".bin") << std::endl;
|
||||||
|
free(buffer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(fread(buffer,1,file_size,F) != file_size)
|
if(fread(buffer,1,file_size,F) != file_size)
|
||||||
{
|
{
|
||||||
std::cerr << "Cannot read from file " + _path+".bin" << ": something's wrong." << std::endl;
|
std::cerr << "Cannot read from file " + _path+".bin" << ": something's wrong." << std::endl;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue