From cb007df40b751153d4583f5d413fb2fbe1b432a8 Mon Sep 17 00:00:00 2001 From: Kelvin Lee Date: Fri, 25 Oct 2019 06:25:07 +1100 Subject: [PATCH] Debugger: Symbol loading: Fix random crash upon start up. (PR #694) --- source/Debugger/Debugger_Symbols.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/Debugger/Debugger_Symbols.cpp b/source/Debugger/Debugger_Symbols.cpp index 811d36ea..491b23a4 100644 --- a/source/Debugger/Debugger_Symbols.cpp +++ b/source/Debugger/Debugger_Symbols.cpp @@ -622,10 +622,13 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym p = strstr(szLine, ";"); // Optional if(p) *p = 0; p = strstr(szLine, " "); // 1st space between name & value - int nLen = p - szLine; - if (nLen > MAX_SYMBOLS_LEN) + if (p) { - memset(&szLine[MAX_SYMBOLS_LEN], ' ', nLen-MAX_SYMBOLS_LEN); // sscanf fails for nAddress if string too long + int nLen = p - szLine; + if (nLen > MAX_SYMBOLS_LEN) + { + memset(&szLine[MAX_SYMBOLS_LEN], ' ', nLen - MAX_SYMBOLS_LEN); // sscanf fails for nAddress if string too long + } } sscanf(szLine, sFormat2, sName, &nAddress); }