mirror of
https://github.com/x64dbg/x64dbg.git
synced 2025-03-02 09:57:29 +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'\\')
|
if(szIniFile[len] == L'\\')
|
||||||
wcscat_s(szIniFile, L".ini");
|
wcscat_s(szIniFile, L".ini");
|
||||||
else
|
else
|
||||||
wcscpy_s(&szIniFile[len], sizeof(szIniFile) - len, L".ini");
|
wcscpy_s(&szIniFile[len], _countof(szIniFile) - len, L".ini");
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
const char* szLib;
|
const char* szLib;
|
||||||
|
@ -2070,7 +2070,8 @@ CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::AddEntry(
|
|||||||
{
|
{
|
||||||
DeleteString(a_pComment);
|
DeleteString(a_pComment);
|
||||||
a_pComment = pComment;
|
a_pComment = pComment;
|
||||||
CopyString(a_pComment);
|
rc = CopyString(a_pComment);
|
||||||
|
if(rc < 0) return rc;
|
||||||
}
|
}
|
||||||
Delete(a_pSection, a_pKey);
|
Delete(a_pSection, a_pKey);
|
||||||
iKey = keyval.end();
|
iKey = keyval.end();
|
||||||
|
@ -65,7 +65,7 @@ UTF8::String UTF8::String::FromFile(const UTF8::String & Path)
|
|||||||
File.read(buf, Length);
|
File.read(buf, Length);
|
||||||
s.AppendString(buf);
|
s.AppendString(buf);
|
||||||
|
|
||||||
delete buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
else
|
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)
|
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)
|
if(this->Substring(n, SubstringLength) == SubString)
|
||||||
{
|
{
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +389,7 @@ void UTF8::String::ConvertFromInt64(int64_t n)
|
|||||||
n /= 10;
|
n /= 10;
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
if((i < 0) || ((i < 1) && minus))
|
if(((int)i < 0) || ((i < 1) && minus))
|
||||||
{
|
{
|
||||||
throw Exception("[ConvertFromInt] Cycle terminated, buffer overflow.");
|
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;
|
tmp[CopyAmount] = 0;
|
||||||
|
|
||||||
UTF8::String r(tmp);
|
UTF8::String r(tmp);
|
||||||
delete tmp;
|
delete[] tmp;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -559,7 +558,7 @@ void UTF8::String::ConvertFromUTF32(const uint32_t* s)
|
|||||||
|
|
||||||
SetString(tmp);
|
SetString(tmp);
|
||||||
|
|
||||||
delete tmp;
|
delete[] tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,7 +679,7 @@ UTF8::String UTF8::String::operator[](unsigned int const n) const
|
|||||||
return UTF8::String();
|
return UTF8::String();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n < 0)
|
if((int)n < 0)
|
||||||
{
|
{
|
||||||
return UTF8::String();
|
return UTF8::String();
|
||||||
}
|
}
|
||||||
@ -728,6 +727,8 @@ unsigned int UTF8::String::GetSequenceLength(const char* StartByte) const
|
|||||||
}
|
}
|
||||||
else
|
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 + "]");
|
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)
|
if(apiname)
|
||||||
{
|
{
|
||||||
char modname[MAX_MODULE_SIZE] = "";
|
char modname[MAX_MODULE_SIZE] = "";
|
||||||
strcpy(modname, name);
|
strcpy_s(modname, name);
|
||||||
modname[apiname - name] = 0;
|
modname[apiname - name] = 0;
|
||||||
apiname++;
|
apiname++;
|
||||||
if(!strlen(apiname))
|
if(!strlen(apiname))
|
||||||
|
@ -36,7 +36,6 @@ public:
|
|||||||
CPUStack* mStack;
|
CPUStack* mStack;
|
||||||
RegistersView* mGeneralRegs;
|
RegistersView* mGeneralRegs;
|
||||||
CPUInfoBox* mInfo;
|
CPUInfoBox* mInfo;
|
||||||
QTabWidget* mRegsTab;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CPUWidget* ui;
|
Ui::CPUWidget* ui;
|
||||||
|
@ -963,7 +963,7 @@ void MainWindow::changeCommandLine()
|
|||||||
cmdline = new char[cbsize];
|
cmdline = new char[cbsize];
|
||||||
DbgFunctions()->GetCmdline(cmdline, 0);
|
DbgFunctions()->GetCmdline(cmdline, 0);
|
||||||
mLineEdit.setText(QString(cmdline));
|
mLineEdit.setText(QString(cmdline));
|
||||||
delete cmdline;
|
delete[] cmdline;
|
||||||
}
|
}
|
||||||
|
|
||||||
mLineEdit.setCursorPosition(0);
|
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)
|
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"";
|
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_EXE_KEY, szLauncherCommand);
|
||||||
RegisterShellExtension(SHELLEXT_DLL_KEY, szLauncherCommand);
|
RegisterShellExtension(SHELLEXT_DLL_KEY, szLauncherCommand);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user