Author: pschweitzer
Date: Sun May 24 17:31:49 2015
New Revision: 67885
URL:
http://svn.reactos.org/svn/reactos?rev=67885&view=rev
Log:
[KMTEST]
Don't attempt to allocate null-size buffer when copying empty string.
Note to next generations students: test your code and DON'T LEAK MEMORY!!!!
It still leaks atm, will have a look later on.
Note to Mr Bragin, beloved ReactOS Project Coordinator: did you actually reviewed your
students work?
CORE-7272
Modified:
trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c
Modified: trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_fsrtl/FsRtlT…
==============================================================================
--- trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c [iso-8859-1] Sun May 24 17:31:49 2015
@@ -33,9 +33,16 @@
ok(b != NULL, "US is NULL after allocated memory\n");
b->Length = 0;
b->MaximumLength =a->MaximumLength;
- b->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, b->MaximumLength, 1633);
- ok(b->Buffer != NULL, "US->Buffer is NULL after allocated
memory\n");
- RtlCopyUnicodeString(b, a);
+ if (b->MaximumLength)
+ {
+ b->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, b->MaximumLength,
1633);
+ ok(b->Buffer != NULL, "US->Buffer is NULL after allocated
memory\n");
+ RtlCopyUnicodeString(b, a);
+ }
+ else
+ {
+ b->Buffer = NULL;
+ }
return b;
}
@@ -147,6 +154,7 @@
TestFsRtlAddToTunnelCache(12345, s_name, l_name, TRUE);
TestFsRtlAddToTunnelCache(12347, s_name, l_name, TRUE);
a = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
+ RtlInitUnicodeString(a, NULL);
TestFsRtlAddToTunnelCache(12346, a, l_name, FALSE);
//Clear all