Prohibit an empty name in RtlSetEnvironmentVariable
authorJeffrey Morlan <mrnobo1024@yahoo.com>
Tue, 26 Aug 2008 14:45:37 +0000 (14:45 +0000)
committerJeffrey Morlan <mrnobo1024@yahoo.com>
Tue, 26 Aug 2008 14:45:37 +0000 (14:45 +0000)
svn path=/trunk/; revision=35671

reactos/lib/rtl/env.c

index cdce037..2e437f7 100644 (file)
@@ -282,6 +282,10 @@ RtlSetEnvironmentVariable(PWSTR *Environment,
    DPRINT("RtlSetEnvironmentVariable(Environment %p Name %wZ Value %wZ)\n",
           Environment, Name, Value);
 
+   /* Variable name must not be empty */
+   if (Name->Length < sizeof(WCHAR))
+      return STATUS_INVALID_PARAMETER;
+
    /* Variable names can't contain a '=' except as a first character. */
    for (wcs = Name->Buffer + 1;
         wcs < Name->Buffer + (Name->Length / sizeof(WCHAR));