From 0f419cccbf58197868e00ab1537020b3a421cad5 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 1 Aug 2024 15:01:43 +0000 Subject: automatic import of gnu-efi --- 0001-Set-0-properly-in-StrnCpy.patch | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 0001-Set-0-properly-in-StrnCpy.patch (limited to '0001-Set-0-properly-in-StrnCpy.patch') diff --git a/0001-Set-0-properly-in-StrnCpy.patch b/0001-Set-0-properly-in-StrnCpy.patch new file mode 100644 index 0000000..f90d1a5 --- /dev/null +++ b/0001-Set-0-properly-in-StrnCpy.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gary Lin +Date: Tue, 9 Oct 2018 18:35:21 +0800 +Subject: [PATCH] Set '\0' properly in StrnCpy() + +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 +Signed-off-by: Nigel Croxon +--- + lib/runtime/rtstr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/runtime/rtstr.c b/lib/runtime/rtstr.c +index 129c9f21ad5..73965cae192 100644 +--- a/lib/runtime/rtstr.c ++++ b/lib/runtime/rtstr.c +@@ -71,7 +71,7 @@ RtStrnCpy ( + { + 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)); + } + -- cgit v1.2.3