From: Yoichi Yuasa Date: Mon, 1 Feb 2010 13:06:56 +0000 (+0900) Subject: MIPS: Alchemy: Use strlcat() for the command line arguments X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=10229f3761fdc1050f972bf3a4c4623bde20002f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git MIPS: Alchemy: Use strlcat() for the command line arguments Signed-off-by: Yoichi Yuasa Cc: linux-mips Patchwork: http://patchwork.linux-mips.org/patch/928/ Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c index 79e099fbc0bf..c29511b11d44 100644 --- a/arch/mips/alchemy/common/prom.c +++ b/arch/mips/alchemy/common/prom.c @@ -45,22 +45,13 @@ char **prom_envp; void prom_init_cmdline(void) { - char *cp; - int actr; - - actr = 1; /* Always ignore argv[0] */ + int i; - cp = &(arcs_cmdline[0]); - while (actr < prom_argc) { - strcpy(cp, prom_argv[actr]); - cp += strlen(prom_argv[actr]); - *cp++ = ' '; - actr++; + for (i = 1; i < prom_argc; i++) { + strlcat(arcs_cmdline, prom_argv[i], COMMAND_LINE_SIZE); + if (i < (prom_argc - 1)) + strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); } - if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */ - --cp; - if (prom_argc > 1) - *cp = '\0'; } char *prom_getenv(char *envname)