mirror of
https://github.com/x64dbg/x64dbg.git
synced 2024-12-02 17:56:50 +00:00
DBG+GUI+BRIDGE+LAUNCHER: fixed various bugs (thanks to Coverity!)
This commit is contained in:
parent
6cc28a1c95
commit
3394b99aa7
@ -40,7 +40,7 @@ BRIDGE_IMPEXP const char* BridgeInit()
|
||||
if(szIniFile[len] == L'\\')
|
||||
wcscat_s(szIniFile, L".ini");
|
||||
else
|
||||
wcscpy_s(&szIniFile[len], sizeof(szIniFile) - len, L".ini");
|
||||
wcscpy_s(&szIniFile[len], _countof(szIniFile) - len, L".ini");
|
||||
|
||||
HINSTANCE hInst;
|
||||
const char* szLib;
|
||||
|
@ -2070,7 +2070,8 @@ CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::AddEntry(
|
||||
{
|
||||
DeleteString(a_pComment);
|
||||
a_pComment = pComment;
|
||||
CopyString(a_pComment);
|
||||
rc = CopyString(a_pComment);
|
||||
if(rc < 0) return rc;
|
||||
}
|
||||
Delete(a_pSection, a_pKey);
|
||||
iKey = keyval.end();
|
||||
|
@ -65,7 +65,7 @@ UTF8::String UTF8::String::FromFile(const UTF8::String & Path)
|
||||
File.read(buf, Length);
|
||||
s.AppendString(buf);
|
||||
|
||||
delete buf;
|
||||
delete[] buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -94,7 +94,7 @@ long UTF8::String::Search(const UTF8::String & SubString, unsigned int StartPosi
|
||||
}
|
||||
}
|
||||
|
||||
if(n < 0)
|
||||
if((int)n < 0)
|
||||
{
|
||||
if(Direction == SearchDirectionFromRightToLeft)
|
||||
{
|
||||
@ -106,12 +106,11 @@ long UTF8::String::Search(const UTF8::String & SubString, unsigned int StartPosi
|
||||
}
|
||||
}
|
||||
|
||||
while(((Direction == SearchDirectionFromLeftToRight) && (n < Length() - SubstringLength + 1)) || ((Direction == SearchDirectionFromRightToLeft) && (n >= 0)))
|
||||
while(((Direction == SearchDirectionFromLeftToRight) && (n < Length() - SubstringLength + 1)) || ((Direction == SearchDirectionFromRightToLeft) && ((int)n >= 0)))
|
||||
{
|
||||
|
||||
if(this->Substring(n, SubstringLength) == SubString)
|
||||
{
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -390,7 +389,7 @@ void UTF8::String::ConvertFromInt64(int64_t n)
|
||||
n /= 10;
|
||||
i--;
|
||||
|
||||
if((i < 0) || ((i < 1) && minus))
|
||||
if(((int)i < 0) || ((i < 1) && minus))
|
||||
{
|
||||
throw Exception("[ConvertFromInt] Cycle terminated, buffer overflow.");
|
||||
}
|
||||
@ -492,7 +491,7 @@ UTF8::String UTF8::String::Substring(unsigned int Start, unsigned int Count) con
|
||||
tmp[CopyAmount] = 0;
|
||||
|
||||
UTF8::String r(tmp);
|
||||
delete tmp;
|
||||
delete[] tmp;
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -559,7 +558,7 @@ void UTF8::String::ConvertFromUTF32(const uint32_t* s)
|
||||
|
||||
SetString(tmp);
|
||||
|
||||
delete tmp;
|
||||
delete[] tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -680,7 +679,7 @@ UTF8::String UTF8::String::operator[](unsigned int const n) const
|
||||
return UTF8::String();
|
||||
}
|
||||
|
||||
if(n < 0)
|
||||
if((int)n < 0)
|
||||
{
|
||||
return UTF8::String();
|
||||
}
|
||||
@ -728,6 +727,8 @@ unsigned int UTF8::String::GetSequenceLength(const char* StartByte) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if(StartByte == 0)
|
||||
StartByte = "(null)";
|
||||
throw Exception(std::string("[GetSequenceLength] Invalid UTF8 start byte (it is empty). My own string is: [") + Data + "] Argument is: [" + StartByte + "]");
|
||||
}
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ bool valapifromstring(const char* name, uint* value, int* value_size, bool print
|
||||
if(apiname)
|
||||
{
|
||||
char modname[MAX_MODULE_SIZE] = "";
|
||||
strcpy(modname, name);
|
||||
strcpy_s(modname, name);
|
||||
modname[apiname - name] = 0;
|
||||
apiname++;
|
||||
if(!strlen(apiname))
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
CPUStack* mStack;
|
||||
RegistersView* mGeneralRegs;
|
||||
CPUInfoBox* mInfo;
|
||||
QTabWidget* mRegsTab;
|
||||
|
||||
private:
|
||||
Ui::CPUWidget* ui;
|
||||
|
@ -963,7 +963,7 @@ void MainWindow::changeCommandLine()
|
||||
cmdline = new char[cbsize];
|
||||
DbgFunctions()->GetCmdline(cmdline, 0);
|
||||
mLineEdit.setText(QString(cmdline));
|
||||
delete cmdline;
|
||||
delete[] cmdline;
|
||||
}
|
||||
|
||||
mLineEdit.setCursorPosition(0);
|
||||
|
@ -183,7 +183,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
if(MessageBoxW(0, L"Do you want to register a shell extension?", L"Question", MB_YESNO | MB_ICONQUESTION) == IDYES)
|
||||
{
|
||||
wchar_t szLauncherCommand[MAX_PATH] = L"";
|
||||
swprintf_s(szLauncherCommand, sizeof(szLauncherCommand), L"\"%s\" \"%%1\"", szModulePath);
|
||||
swprintf_s(szLauncherCommand, _countof(szLauncherCommand), L"\"%s\" \"%%1\"", szModulePath);
|
||||
RegisterShellExtension(SHELLEXT_EXE_KEY, szLauncherCommand);
|
||||
RegisterShellExtension(SHELLEXT_DLL_KEY, szLauncherCommand);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user