diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index fb39a22a42..86828e65fc 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -116,7 +116,7 @@ StrnCpy ( ReturnValue = Destination; - while ((*Source != L'\0') && (Length > 1)) { + while ((*Source != L'\0') && (Length > 0)) { *(Destination++) = *(Source++); Length--; } @@ -481,7 +481,7 @@ AsciiStrnCpy ( ReturnValue = Destination; - while (*Source && Length > 1) { + while (*Source && Length > 0) { *(Destination++) = *(Source++); Length--; }