Commit 63e49e13 authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix potential crash on Windows: off-by-one in malloc()

Spotted by gdb's malloc debugger while I was looking for something else.
parent 529b0ae1
......@@ -2817,7 +2817,7 @@ cstring_from_section_name (UChar* name, UChar* strtab)
int strtab_offset = strtol((char*)name+1,NULL,10);
int len = strlen(((char*)strtab) + strtab_offset);
newstr = stgMallocBytes(len, "cstring_from_section_symbol_name");
newstr = stgMallocBytes(len+1, "cstring_from_section_symbol_name");
strcpy((char*)newstr, (char*)((UChar*)strtab) + strtab_offset);
return newstr;
Supports Markdown
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