From d43c57d945f42dd0dbaca747a646a769e49082da Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Fri, 16 Nov 2012 14:23:45 +0000 Subject: [PATCH] hdt-cli: Correct malloc() size argument We need to be allocating sizeof(char *) (4) not sizeof(char) (1) for 'new_argv'. Cc: Erwan Velu Signed-off-by: Matt Fleming --- com32/hdt/hdt-cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c index 7542da83..216b6bde 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