summaryrefslogtreecommitdiff
path: root/common/cli.c
diff options
context:
space:
mode:
authorRasmus Villemoes <[email protected]>2026-04-21 09:54:37 +0200
committerTom Rini <[email protected]>2026-05-12 15:38:00 -0600
commit11168813bf9c088e1fce8a96f4b493ee815c966b (patch)
treec0b375f70d95c7eb3e3ce46f0ac428656b34608a /common/cli.c
parentb87ff4878d081103c45f0ebea7528609a0b173f3 (diff)
common/cli.c: use memdup_nul() in run_command_list()
Use memdup_nul() instead of open-coding it. Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Rasmus Villemoes <[email protected]>
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 4694a35cd0e..ccf7e26e821 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()) {