From 4b335e4b7619eb12240de84cd256e5d0c3d6c84c Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 24 Oct 2016 18:33:31 +0100 Subject: EmbeddedPkg/MmcDxe: eliminate deprecated string function calls Get rid of calls to unsafe string functions. These are deprecated and may be removed in the future. Note that this also fixes an existing issue in the code, where the buffer may be overrun by one character when en == mLogRemainChar, in which case the NUL terminator ends up after the end of the buffer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- EmbeddedPkg/Universal/MmcDxe/Diagnostics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'EmbeddedPkg/Universal') diff --git a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c index 783e548d2a..7d6a5a0dde 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c +++ b/EmbeddedPkg/Universal/MmcDxe/Diagnostics.c @@ -42,9 +42,9 @@ DiagnosticLog ( ) { UINTN len = StrLen (Str); - if (len <= mLogRemainChar) { + if (len < mLogRemainChar) { + StrCpyS (mLogBuffer, mLogRemainChar, Str); mLogRemainChar -= len; - StrCpy (mLogBuffer, Str); mLogBuffer += len; return len; } else { -- cgit v1.2.3