From ed825c1d462a320437f2d5b3c04337015e4367d4 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 23 Apr 2013 11:52:45 +0200 Subject: [PATCH] nova: fix bootstrap bug commandline_to_basename may adjust the pointer of the string, recalculate the length accordingly. --- base-nova/src/core/platform.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/base-nova/src/core/platform.cc b/base-nova/src/core/platform.cc index 999f8722a9..c54578b86a 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 {