From: Ard Biesheuvel Date: Mon, 24 Oct 2016 17:33:31 +0000 (+0100) Subject: EmbeddedPkg/MmcDxe: eliminate deprecated string function calls X-Git-Tag: edk2-stable201903~5404 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=4b335e4b7619eb12240de84cd256e5d0c3d6c84c 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 --- 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 {