aboutsummaryrefslogtreecommitdiff
path: root/src/tools/mac
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/mac')
-rw-r--r--src/tools/mac/crash_report/on_demand_symbol_supplier.h3
-rw-r--r--src/tools/mac/crash_report/on_demand_symbol_supplier.mm9
2 files changed, 8 insertions, 4 deletions
diff --git a/src/tools/mac/crash_report/on_demand_symbol_supplier.h b/src/tools/mac/crash_report/on_demand_symbol_supplier.h
index 28002c6b..3fbe108e 100644
--- a/src/tools/mac/crash_report/on_demand_symbol_supplier.h
+++ b/src/tools/mac/crash_report/on_demand_symbol_supplier.h
@@ -66,7 +66,8 @@ class OnDemandSymbolSupplier : public SymbolSupplier {
virtual SymbolResult GetCStringSymbolData(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
- char **symbol_data);
+ char **symbol_data,
+ size_t *symbol_data_size);
// Delete the data buffer allocated for module in GetCStringSymbolData().
virtual void FreeSymbolData(const CodeModule *module);
diff --git a/src/tools/mac/crash_report/on_demand_symbol_supplier.mm b/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
index 1bd1f693..93b4c362 100644
--- a/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
+++ b/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
@@ -164,19 +164,22 @@ SymbolSupplier::SymbolResult
OnDemandSymbolSupplier::GetCStringSymbolData(const CodeModule *module,
const SystemInfo *system_info,
string *symbol_file,
- char **symbol_data) {
+ char **symbol_data,
+ uint64_t *symbol_data_size) {
std::string symbol_data_string;
SymbolSupplier::SymbolResult result = GetSymbolFile(module,
system_info,
symbol_file,
&symbol_data_string);
if (result == FOUND) {
- *symbol_data = new char[symbol_data_string.size() + 1];
+ *symbol_data_size = symbol_data_string.size() + 1;
+ *symbol_data = new char[*symbol_data_size];
if (*symbol_data == NULL) {
// Should return INTERRUPT on memory allocation failure.
return INTERRUPT;
}
- strcpy(*symbol_data, symbol_data_string.c_str());
+ memcpy(*symbol_data, symbol_data_string.c_str(), symbol_data_string.size());
+ (*symbol_data)[symbol_data_string.size()] = '\0';
memory_buffers_.insert(make_pair(module->code_file(), *symbol_data));
}
return result;