aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-16 14:23:45 +0000
committerH. Peter Anvin <hpa@zytor.com>2014-02-12 09:57:04 -0800
commite768f7133bcba919f7df4a1cd605ac63ff34cdbc (patch)
treee9c5e2917626611db0843c16f06ad3e3cfd6f6f4
parent003a288a03c2384bd42b36edbe3bf13714f84700 (diff)
downloadsyslinux-e768f7133bcba919f7df4a1cd605ac63ff34cdbc.tar.gz
syslinux-e768f7133bcba919f7df4a1cd605ac63ff34cdbc.tar.xz
syslinux-e768f7133bcba919f7df4a1cd605ac63ff34cdbc.zip
hdt-cli: Correct malloc() size argument
We need to be allocating sizeof(char *) (4) not sizeof(char) (1) for 'new_argv'. Cc: Erwan Velu <erwanaliasr1@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/hdt/hdt-cli.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 8c43800a..2895b13c 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -649,7 +649,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
if ((current_module->nomodule == true) && ( module != NULL)) {
dprintf("CLI_DEBUG exec: Reworking arguments with argc=%d\n",argc);
char **new_argv=NULL;
- new_argv=malloc((argc + 2)*sizeof(char));
+ new_argv=malloc((argc + 2)*sizeof(char *));
for (int argc_iter=0; argc_iter<argc; argc_iter++) {
dprintf("CLI_DEBUG exec rework : copy %d to %d (%s)\n",argc_iter,argc_iter+1,argv[argc_iter]);
new_argv[argc_iter+1] = malloc(strlen(argv[argc_iter]));