summaryrefslogtreecommitdiff
path: root/common/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/cli.c')
-rw-r--r--common/cli.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/common/cli.c b/common/cli.c
index bcc7264d51a..87ce0e4d144 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -138,11 +138,9 @@ int run_command_list(const char *cmd, int len, int flag)
#endif
}
if (need_buff) {
- buff = malloc(len + 1);
+ buff = memdup_nul(cmd, len);
if (!buff)
return 1;
- memcpy(buff, cmd, len);
- buff[len] = '\0';
}
#ifdef CONFIG_HUSH_PARSER
if (use_hush_old()) {