[syslinux:syslinux-4.xx] hdt-cli: Correct malloc() size argument
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Wed Feb 12 10:00:05 PST 2014
Commit-ID: e768f7133bcba919f7df4a1cd605ac63ff34cdbc
Gitweb: http://www.syslinux.org/commit/e768f7133bcba919f7df4a1cd605ac63ff34cdbc
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Fri, 16 Nov 2012 14:23:45 +0000
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 12 Feb 2014 09:57:04 -0800
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 at gmail.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
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 8c43800..2895b13 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]));
More information about the Syslinux-commits
mailing list