From a37383db8081b66eafc3860ede23edbfd39ac8ad Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 26 Nov 2013 02:41:26 +0100 Subject: Replace all occurences of sprintf with snprintf THis reduces risks of bufer overflows. Change-Id: I77f80e76efec16ac0a0af83d76430a8126a7602d Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/4279 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/ec/lenovo/h8/h8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ec/lenovo/h8') diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c index 4f9d2281ab..213ede352b 100644 --- a/src/ec/lenovo/h8/h8.c +++ b/src/ec/lenovo/h8/h8.c @@ -125,14 +125,14 @@ u8 h8_build_id_and_function_spec_version(char *buf, u8 buf_len) for (i = 0; i < 8; i++) { c = ec_read(0xf0 + i); if (c < 0x20 || c > 0x7f) { - i = sprintf(str, "*INVALID"); + i = snprintf(str, sizeof (str), "*INVALID"); break; } str[i] = c; } /* EC firmware function specification version */ - i += sprintf(str + i, "-%u.%u", ec_read(0xef), ec_read(0xeb)); + i += snprintf(str + i, sizeof (str) - i, "-%u.%u", ec_read(0xef), ec_read(0xeb)); i = MIN(buf_len, i); memcpy(buf, str, i); -- cgit v1.2.3