https://git.reactos.org/?p=reactos.git;a=commitdiff;h=739c9a1e77d5218bdc76a…
commit 739c9a1e77d5218bdc76a5ee942cbef24b497463
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Jan 10 11:36:51 2023 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Jan 24 18:53:13 2023 +0100
[WINESYNC] msvcrt: Fixed strncpy_s behavior when count equals 0.
wine commit id bdf9a9f9bd56354f70a7431a9682183b84353211 by Piotr Caban
<piotr(a)codeweavers.com>
---
sdk/lib/crt/wine/heap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sdk/lib/crt/wine/heap.c b/sdk/lib/crt/wine/heap.c
index ad809de181c..6a49988c63b 100644
--- a/sdk/lib/crt/wine/heap.c
+++ b/sdk/lib/crt/wine/heap.c
@@ -819,8 +819,11 @@ int CDECL MSVCRT_strncpy_s(char *dest, MSVCRT_size_t
numberOfElements,
TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count);
- if(!count)
+ if(!count) {
+ if(dest && numberOfElements)
+ *dest = 0;
return 0;
+ }
if (!MSVCRT_CHECK_PMT(dest != NULL)) return MSVCRT_EINVAL;
if (!MSVCRT_CHECK_PMT(src != NULL)) return MSVCRT_EINVAL;