1
0
Fork 0

DBG: fixed a bug with database storing on entries with empty modules

This commit is contained in:
mrexodia 2016-06-03 18:35:47 +02:00
parent c801811184
commit abe53d3492
No known key found for this signature in database
GPG Key ID: D72F9A4FAA0073B4
7 changed files with 17 additions and 7 deletions

View File

@ -66,7 +66,8 @@ bool ArgumentAdd(duint Start, duint End, bool Manual, duint InstructionCount)
return false;
ARGUMENTSINFO argument;
ModNameFromAddr(Start, argument.mod, true);
if(!ModNameFromAddr(Start, argument.mod, true))
*argument.mod = '\0';
argument.start = Start - moduleBase;
argument.end = End - moduleBase;
argument.manual = Manual;

View File

@ -49,7 +49,8 @@ bool BookmarkSet(duint Address, bool Manual)
return false;
BOOKMARKSINFO bookmark;
ModNameFromAddr(Address, bookmark.mod, true);
if(!ModNameFromAddr(Address, bookmark.mod, true))
*bookmark.mod = '\0';
bookmark.addr = Address - ModBaseFromAddr(Address);
bookmark.manual = Manual;

View File

@ -65,7 +65,8 @@ bool CommentSet(duint Address, const char* Text, bool Manual)
// Fill out the structure
COMMENTSINFO comment;
strcpy_s(comment.text, Text);
ModNameFromAddr(Address, comment.mod, true);
if(!ModNameFromAddr(Address, comment.mod, true))
*comment.mod = '\0';
comment.manual = Manual;
comment.addr = Address - ModBaseFromAddr(Address);

View File

@ -68,7 +68,8 @@ bool FunctionAdd(duint Start, duint End, bool Manual, duint InstructionCount)
return false;
FUNCTIONSINFO function;
ModNameFromAddr(Start, function.mod, true);
if(!ModNameFromAddr(Start, function.mod, true))
*function.mod = '\0';
function.start = Start - moduleBase;
function.end = End - moduleBase;
function.manual = Manual;

View File

@ -2,6 +2,7 @@
#include "threading.h"
#include "module.h"
#include "memory.h"
#include "console.h"
struct CommentSerializer : JSONWrapper<LABELSINFO>
{
@ -71,7 +72,8 @@ bool LabelSet(duint Address, const char* Text, bool Manual)
labelInfo.manual = Manual;
labelInfo.addr = Address - ModBaseFromAddr(Address);
strcpy_s(labelInfo.text, Text);
ModNameFromAddr(Address, labelInfo.mod, true);
if(!ModNameFromAddr(Address, labelInfo.mod, true))
*labelInfo.mod = '\0';
return labels.Add(labelInfo);
}

View File

@ -27,7 +27,10 @@ protected:
template<size_t TSize>
bool getString(const char* key, char(&_Dest)[TSize]) const
{
auto str = json_string_value(json_object_get(mJson, key));
auto jsonValue = get(key);
if(!jsonValue)
return false;
auto str = json_string_value(jsonValue);
if(str && strlen(str) < TSize)
{
strcpy_s(_Dest, str);

View File

@ -104,7 +104,8 @@ bool XrefAdd(duint Address, duint From)
if(found == mapData.end())
{
XREFSINFO info;
ModNameFromAddr(Address, info.mod, true);
if(!ModNameFromAddr(Address, info.mod, true))
*info.mod = '\0';
info.address = Address - moduleBase;
info.type = xrefRecord.type;
info.references.insert({ xrefRecord.addr, xrefRecord });