diff --git a/base-nova/src/core/platform.cc b/base-nova/src/core/platform.cc index 999f8722a..c54578b86 100644 --- a/base-nova/src/core/platform.cc +++ b/base-nova/src/core/platform.cc @@ -525,8 +525,9 @@ Platform::Platform() : /* all behind rom module will be cleared, copy the command line */ char *name_tmp = commandline_to_basename(reinterpret_cast(aux)); - name = new (core_mem_alloc()) char [aux_len]; - memcpy(name, name_tmp, aux_len); + unsigned name_tmp_size = aux_len - (name_tmp - reinterpret_cast(aux)); + name = new (core_mem_alloc()) char [name_tmp_size]; + memcpy(name, name_tmp, name_tmp_size); } else {