From: Stefan Agner <stefan.agner@toradex.com>
Date: Wed, 28 Sep 2016 09:29:28 +0000 (+0200)
Subject: ARM: vf610: use strcpy for soc environment variable
X-Git-Tag: v2025.01-rc5-pxa1908~8335^2~1
X-Git-Url: http://git.dujemihanovic.xyz/%22bddb.css/static/gitweb.css?a=commitdiff_plain;h=d7255e8ddbfe76d7b0d18247d35742596c85ad93;p=u-boot.git

ARM: vf610: use strcpy for soc environment variable

To create the soc environment variable we concatenate two strings
on the stack. So far, strcat has been used for the first string as
well as for the second string. Since the variable on the stack is
not initialized, the first strcat may not start using the first
entry in the character array. This then could lead to an buffer
overflow on the stack.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
---

diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 08b9ef42a1..50eb0c6b97 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -322,7 +322,7 @@ int arch_misc_init(void)
 {
 	char soc[6];
 
-	strcat(soc, "vf");
+	strcpy(soc, "vf");
 	strcat(soc, soc_type);
 	setenv("soc", soc);