|
From: Tom H. <th...@cy...> - 2004-09-13 10:20:45
|
CVS commit by thughes:
When augmenting the argument vector from the VALGRIND_OPTS environment
variable and/or the .valgrindrc files, make sure that enough space is
allocated for all the old arguments, not just those that are arguments
to valgrind itself.
CCMAIL: 886...@bu...
M +5 -3 vg_main.c 1.212
--- valgrind/coregrind/vg_main.c #1.211:1.212
@@ -552,5 +552,7 @@ static void augment_command_line(Int* vg
char **from;
char **to;
- int env_arg_count, f1_arg_count, f2_arg_count;
+ int orig_arg_count, env_arg_count, f1_arg_count, f2_arg_count;
+
+ for ( orig_arg_count = 0; vg_argv0[orig_arg_count]; orig_arg_count++ );
env_arg_count = count_args(env_clo);
@@ -564,5 +566,5 @@ static void augment_command_line(Int* vg
/* +2: +1 for null-termination, +1 for added '--' */
from = vg_argv0;
- vg_argv0 = malloc( (vg_argc0 + env_arg_count + f1_arg_count
+ vg_argv0 = malloc( (orig_arg_count + env_arg_count + f1_arg_count
+ f2_arg_count + 2) * sizeof(char **));
vg_assert(vg_argv0);
|