Commit f6e28fd5 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

merge fix from 5.0-bugteam

parents 4f3d241b a4987b44
...@@ -451,7 +451,12 @@ static void get_symbol_path(char *path, size_t size) ...@@ -451,7 +451,12 @@ static void get_symbol_path(char *path, size_t size)
if (!strstr(path, module_dir)) if (!strstr(path, module_dir))
{ {
strncat(path, module_dir, size); size_t dir_len = strlen(module_dir);
if (size > dir_len)
{
strncat(path, module_dir, size-1);
size -= dir_len;
}
} }
} }
CloseHandle(hSnap); CloseHandle(hSnap);
...@@ -459,9 +464,9 @@ static void get_symbol_path(char *path, size_t size) ...@@ -459,9 +464,9 @@ static void get_symbol_path(char *path, size_t size)
/* Add _NT_SYMBOL_PATH, if present. */ /* Add _NT_SYMBOL_PATH, if present. */
envvar= getenv("_NT_SYMBOL_PATH"); envvar= getenv("_NT_SYMBOL_PATH");
if(envvar) if(envvar && size)
{ {
strncat(path, envvar, size); strncat(path, envvar, size-1);
} }
} }
...@@ -483,7 +488,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) ...@@ -483,7 +488,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
int i; int i;
CONTEXT context; CONTEXT context;
STACKFRAME64 frame={0}; STACKFRAME64 frame={0};
static char symbol_path[MAX_SYMBOL_PATH+1]; static char symbol_path[MAX_SYMBOL_PATH];
if(!exception_ptrs || !init_dbghelp_functions()) if(!exception_ptrs || !init_dbghelp_functions())
return; return;
...@@ -492,7 +497,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) ...@@ -492,7 +497,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
context = *(exception_ptrs->ContextRecord); context = *(exception_ptrs->ContextRecord);
/*Initialize symbols.*/ /*Initialize symbols.*/
pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG); pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
get_symbol_path(symbol_path, MAX_SYMBOL_PATH); get_symbol_path(symbol_path, sizeof(symbol_path));
pSymInitialize(hProcess, symbol_path, TRUE); pSymInitialize(hProcess, symbol_path, TRUE);
/*Prepare stackframe for the first StackWalk64 call*/ /*Prepare stackframe for the first StackWalk64 call*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment