git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@180 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 17 years ago
parent 8446ef1f75
commit 7c117cdab2
  1. 1
      changelog
  2. 9
      src/Kdb3Database.cpp

@ -10,6 +10,7 @@
- fixed potential compilation problem in AES implementation (Bug #1905810) - fixed potential compilation problem in AES implementation (Bug #1905810)
- fixed crash when re-arranging groups (Bug #1754998) - fixed crash when re-arranging groups (Bug #1754998)
- fixed size problems of some dialogs - fixed size problems of some dialogs
- files are not longer truncated when saving fails (Bug #1648616)
--------------- ---------------
0.3.0a 0.3.0a

@ -1101,6 +1101,7 @@ bool Kdb3Database::save(){
quint8 FinalRandomSeed[16]; quint8 FinalRandomSeed[16];
quint8 ContentsHash[32]; quint8 ContentsHash[32];
quint8 EncryptionIV[16]; quint8 EncryptionIV[16];
if(!(File->openMode() & QIODevice::WriteOnly)){ if(!(File->openMode() & QIODevice::WriteOnly)){
File->close(); File->close();
} }
@ -1239,9 +1240,15 @@ bool Kdb3Database::save(){
return false; return false;
} }
File->resize(0); //truncate if(!File->resize(EncryptedPartSize+DB_HEADER_SIZE)){
delete [] buffer;
error=decodeFileError(File->error());
return false;
}
File->seek(0);
if(File->write(buffer,EncryptedPartSize+DB_HEADER_SIZE)!=EncryptedPartSize+DB_HEADER_SIZE){ if(File->write(buffer,EncryptedPartSize+DB_HEADER_SIZE)!=EncryptedPartSize+DB_HEADER_SIZE){
delete [] buffer; delete [] buffer;
error=decodeFileError(File->error());
return false; return false;
} }
File->flush(); File->flush();