From: Piotr Wilczek <p.wilczek@samsung.com>
Date: Fri, 11 Oct 2013 13:43:33 +0000 (+0200)
Subject: fs:fat: fix set file name function
X-Git-Tag: v2025.01-rc5-pxa1908~15669
X-Git-Url: http://git.dujemihanovic.xyz/%7B%7B%20.Permalink%20%7D%7D?a=commitdiff_plain;h=73dc8328c3d842c9093d358dad61d4fd8b3fa2c5;p=u-boot.git

fs:fat: fix set file name function

Curently memcpy copies string without null terminating char because
function strlen returns only number of characters excluding
null terminating character. Replace memcpy with strcpy.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Tom Rini <trini@ti.com>
---

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index b7a21e05bf..9f5e911852 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -57,7 +57,7 @@ static void set_name(dir_entry *dirent, const char *filename)
 	if (len == 0)
 		return;
 
-	memcpy(s_name, filename, len);
+	strcpy(s_name, filename);
 	uppercase(s_name, len);
 
 	period = strchr(s_name, '.');