summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2018-10-11 16:10:26 +0800
committerNigel Croxon <ncroxon@redhat.com>2018-10-11 08:35:06 -0400
commit6058ffcd54cffea196c5aadef4ba5b5af6114648 (patch)
treefcd6be8effd128cf0de1f2c0033cec0eb9a2af2b /lib
parent85f1c797f6935223205159dd108e4871b2e55500 (diff)
downloadgnu-efi-6058ffcd54cffea196c5aadef4ba5b5af6114648.tar.gz
Set '\0' properly in StpnCpy()
The arguments to SetMem() were wrong. Besides, SetMem() should start at "Dest + Size" since "Size" will be smaller than "Len" if they are not equal. Signed-off-by: Gary Lin <glin@suse.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/runtime/rtstr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/runtime/rtstr.c b/lib/runtime/rtstr.c
index dcc1a2a..65cc018 100644
--- a/lib/runtime/rtstr.c
+++ b/lib/runtime/rtstr.c
@@ -94,7 +94,7 @@ RtStpCpy (
}
#ifndef __GNUC__
-#pragma RUNTIME_CODE(RtStrnCpy)
+#pragma RUNTIME_CODE(RtStpnCpy)
#endif
CHAR16 *
RUNTIMEFUNCTION
@@ -107,7 +107,7 @@ RtStpnCpy (
{
UINTN Size = RtStrnLen(Src, Len);
if (Size != Len)
- RtSetMem(Dest + Len, '\0', (UINT8)((Len - Size) * sizeof(CHAR16)));
+ RtSetMem(Dest + Size, (Len - Size) * sizeof(CHAR16), '\0');
RtCopyMem(Dest, Src, Size * sizeof(CHAR16));
return Dest + Size;
}