From 6cfb0c24a8c22b1379f72f089334112b3d271f9a Mon Sep 17 00:00:00 2001 From: mdkinney Date: Tue, 25 Apr 2006 23:30:07 +0000 Subject: [PATCH] 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 --- MdePkg/Library/BaseLib/String.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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--; }