summaryrefslogtreecommitdiff
path: root/common/fb_mmc.c
diff options
context:
space:
mode:
authorDileep Katta <dileep.katta@linaro.org>2015-02-13 14:33:42 +0800
committerMarek Vasut <marex@denx.de>2015-02-25 17:47:02 +0100
commite874207134e9d2d5958636f7f32b60e5441ab320 (patch)
tree429c3cd7b1bf2eea826bc752da895878061cf18e /common/fb_mmc.c
parent9e4b510d40310bf46e09f4edd0a0b6356213df47 (diff)
downloadu-boot-imx-e874207134e9d2d5958636f7f32b60e5441ab320.zip
u-boot-imx-e874207134e9d2d5958636f7f32b60e5441ab320.tar.gz
u-boot-imx-e874207134e9d2d5958636f7f32b60e5441ab320.tar.bz2
fastboot: Correct fastboot_fail and fastboot_okay strings
If the string is copied without NULL termination using strncpy(), then strncat() on the next line, may concatenate the string after some stale (or random) data, if the response string was not zero-initialized. Signed-off-by: Dileep Katta <dileep.katta@linaro.org> Reviewed-by: Steve Rae <srae@broadcom.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'common/fb_mmc.c')
-rw-r--r--common/fb_mmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index 513b7ab..75899e4 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -23,13 +23,13 @@ static char *response_str;
void fastboot_fail(const char *s)
{
- strncpy(response_str, "FAIL", 4);
+ strncpy(response_str, "FAIL\0", 5);
strncat(response_str, s, RESPONSE_LEN - 4 - 1);
}
void fastboot_okay(const char *s)
{
- strncpy(response_str, "OKAY", 4);
+ strncpy(response_str, "OKAY\0", 5);
strncat(response_str, s, RESPONSE_LEN - 4 - 1);
}