https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c0d9c01e20574c427a23…
commit 6c0d9c01e20574c427a23f005a8b878fc5a6c115
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Mon Sep 17 23:19:02 2018 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Mon Sep 17 23:19:02 2018 +0200
[ADVAPI32] SystemFunction004 and SystemFunction005 must return the required output
buffer size via out->Length when the buffer is too small.
---
dll/win32/advapi32/misc/sysfunc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dll/win32/advapi32/misc/sysfunc.c b/dll/win32/advapi32/misc/sysfunc.c
index b0ed231faf..b6bee62248 100644
--- a/dll/win32/advapi32/misc/sysfunc.c
+++ b/dll/win32/advapi32/misc/sysfunc.c
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
- * FILE: dll/win32/advapi32/misc/sysfun.c
+ * FILE: dll/win32/advapi32/misc/sysfunc.c
* PURPOSE: advapi32.dll system functions (undocumented)
* PROGRAMMER: Emanuele Aliberti
* UPDATE HISTORY:
@@ -130,7 +130,10 @@ WINAPI SystemFunction004(const struct ustring *in,
crypt_len = ((in->Length+7)&~7);
if (out->MaximumLength < (crypt_len+8))
+ {
+ out->Length = crypt_len + 8;
return STATUS_BUFFER_TOO_SMALL;
+ }
data.ui[0] = in->Length;
data.ui[1] = 1;
@@ -203,7 +206,10 @@ WINAPI SystemFunction005(const struct ustring *in,
crypt_len = data.ui[0];
if (crypt_len > out->MaximumLength)
+ {
+ out->Length = crypt_len;
return STATUS_BUFFER_TOO_SMALL;
+ }
for (ofs=0; (ofs+8)<crypt_len; ofs+=8)
CRYPT_DESunhash(out->Buffer+ofs, deskey, in->Buffer+ofs+8);