From: Rasmus Villemoes Date: Tue, 21 Apr 2026 07:54:37 +0000 (+0200) Subject: common/cli.c: use memdup_nul() in run_command_list() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11168813bf9c088e1fce8a96f4b493ee815c966b;p=thirdparty%2Fu-boot.git common/cli.c: use memdup_nul() in run_command_list() Use memdup_nul() instead of open-coding it. Reviewed-by: Simon Glass Signed-off-by: Rasmus Villemoes --- 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()) {