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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Ard Biesheuvel 2016-10-24 18:33:31 +01:00
parent e2dede1bc4
commit 4b335e4b76
1 changed files with 2 additions and 2 deletions

View File

@ -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 {