mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Bug in handling wrong passphrase on decryption
This commit is contained in:
parent
b843870b5a
commit
5f108132ae
@ -7,7 +7,7 @@ Language=CPlusPlus
|
||||
Major=auto
|
||||
Minor=auto
|
||||
Maintenance=auto
|
||||
Build=291
|
||||
Build=293
|
||||
|
||||
[CSharp]
|
||||
AssemConfig=Rizonesoft.Voice.Win\Properties\AssemblyInfo.cs.conf
|
||||
|
||||
@ -361,32 +361,33 @@ BOOL ReadAndDecryptFile(HWND hwnd, HANDLE hFile, DWORD size, void** result, DWOR
|
||||
AES_bin_setup(&fileDecode, AES_DIR_DECRYPT, KEY_BYTES * 8, binFileKey);
|
||||
AES_bin_cipherInit(&fileCypher, AES_MODE_CBC, &rawdata[PREAMBLE_SIZE]); // IV is next
|
||||
{ // finally, decrypt the actual data
|
||||
unsigned long nb = 0;
|
||||
int nbb = 0;
|
||||
int nbp = 0;
|
||||
if ((readsize - code_offset) > PAD_SLOP) {
|
||||
nb += AES_blockDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset], readsize - code_offset - PAD_SLOP, rawdata);
|
||||
nbb = AES_blockDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset], readsize - code_offset - PAD_SLOP, rawdata);
|
||||
}
|
||||
nb += AES_padDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset + nb], readsize - code_offset - nb, rawdata + nb);
|
||||
if (nb > 0) {
|
||||
rawdata[nb] = (char)0;
|
||||
rawdata[nb + 1] = (char)0; // two zeros in case it's multibyte
|
||||
*resultlen = (DWORD)nb;
|
||||
bReadSuccess = 1;
|
||||
usedEncryption = TRUE;
|
||||
nbp = AES_padDecrypt(&fileCypher, &fileDecode, &rawdata[code_offset + nbb], readsize - code_offset - nbb, rawdata + nbb);
|
||||
if (nbp > 0) {
|
||||
nbb += nbp;
|
||||
rawdata[nbb] = (char)0;
|
||||
rawdata[nbb + 1] = (char)0; // two zeros in case it's multi-byte
|
||||
*resultlen = (DWORD)nbb;
|
||||
bReadSuccess = TRUE;
|
||||
}
|
||||
else {
|
||||
*resultlen = 0;
|
||||
MsgBox(MBWARN, IDS_PASS_FAILURE);
|
||||
bReadSuccess = -1;
|
||||
usedEncryption = FALSE;
|
||||
*resultlen = 0;
|
||||
bReadSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
usedEncryption = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// simulate read failure
|
||||
MsgBox(MBWARN, IDS_NOPASS);
|
||||
*resultlen = 0;
|
||||
bReadSuccess = -1;
|
||||
bReadSuccess = FALSE;
|
||||
usedEncryption = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[Version]
|
||||
Build=60
|
||||
Build=62
|
||||
VersionHeader=src\VersionEx.h
|
||||
ManifestConfig=res\MiniPath.exe.manifest.conf
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="MiniPath"
|
||||
processorArchitecture="*"
|
||||
version="0.0.6.60"
|
||||
version="0.0.6.62"
|
||||
type="win32"
|
||||
/>
|
||||
<description>metapath</description>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REV 6
|
||||
#define VERSION_BUILD 60
|
||||
#define VERSION_BUILD 62
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="0.2.9.291"
|
||||
version="0.2.9.293"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3</description>
|
||||
|
||||
10
src/Edit.c
10
src/Edit.c
@ -1775,7 +1775,7 @@ void EditTitleCase(HWND hwnd)
|
||||
{
|
||||
if (IsCharLowerW(pszTextW[i]))
|
||||
{
|
||||
pszTextW[i] = LOWORD(CharUpperW((LPWSTR)MAKELONG(pszTextW[i],0)));
|
||||
pszTextW[i] = LOWORD(CharUpperW((LPWSTR)(SIZE_T)MAKELONG(pszTextW[i],0)));
|
||||
bChanged = TRUE;
|
||||
}
|
||||
}
|
||||
@ -1783,7 +1783,7 @@ void EditTitleCase(HWND hwnd)
|
||||
{
|
||||
if (IsCharUpperW(pszTextW[i]))
|
||||
{
|
||||
pszTextW[i] = LOWORD(CharLowerW((LPWSTR)MAKELONG(pszTextW[i],0)));
|
||||
pszTextW[i] = LOWORD(CharLowerW((LPWSTR)(SIZE_T)MAKELONG(pszTextW[i],0)));
|
||||
bChanged = TRUE;
|
||||
}
|
||||
}
|
||||
@ -2212,7 +2212,7 @@ void EditHex2Char(HWND hwnd) {
|
||||
bTrySelExpand = TRUE;
|
||||
}
|
||||
|
||||
if (sscanf(ch,"%x",&i) == 1) {
|
||||
if (sscanf_s(ch,"%x",&i) == 1) {
|
||||
int cch;
|
||||
if (i == 0) {
|
||||
ch[0] = 0;
|
||||
@ -2264,7 +2264,7 @@ void EditModifyNumber(HWND hwnd,BOOL bIncrease) {
|
||||
if (StrChrIA(chNumber,'-'))
|
||||
return;
|
||||
|
||||
if (!StrChrIA(chNumber,'x') && sscanf(chNumber,"%d",&iNumber) == 1) {
|
||||
if (!StrChrIA(chNumber, 'x') && sscanf_s(chNumber, "%d", &iNumber) == 1) {
|
||||
iWidth = lstrlenA(chNumber);
|
||||
if (iNumber >= 0) {
|
||||
if (bIncrease && iNumber < INT_MAX)
|
||||
@ -7103,7 +7103,7 @@ BOOL FileVars_ParseInt(char* pszData,char* pszName,int* piValue) {
|
||||
*pvEnd = 0;
|
||||
StrTrimA(tch," \t:=\"'");
|
||||
|
||||
itok = sscanf(tch,"%i",piValue);
|
||||
itok = sscanf_s(tch,"%i",piValue);
|
||||
if (itok == 1)
|
||||
return(TRUE);
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_REV 9
|
||||
#define VERSION_BUILD 291
|
||||
#define VERSION_BUILD 293
|
||||
|
||||
Loading…
Reference in New Issue
Block a user