From: mdkinney Date: Tue, 25 Apr 2006 23:30:07 +0000 (+0000) Subject: Fix bug in StrnCpy() and AsciStrnCpy(). It was copying Length - 1 characters instead... X-Git-Tag: edk2-stable201903~25586 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=6cfb0c24a8c22b1379f72f089334112b3d271f9a Fix bug in StrnCpy() and AsciStrnCpy(). It was copying Length - 1 characters instead of Length characters. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@34 6f19259b-4bc3-4df7-8a09-765794883524 --- 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--; }