summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
02affbb)
In NtQuerySystemEnvironmentValue :
- Use a fixed-length buffer size for holding a temporary variable.
- Correct the pool TAG.
svn path=/trunk/; revision=57514
#define NDEBUG
#include <debug.h>
#define NDEBUG
#include <debug.h>
+/* The maximum size of an environment value (in bytes) */
+#define MAX_ENVVAL_SIZE 1024
+
FAST_MUTEX ExpEnvironmentLock;
ERESOURCE ExpFirmwareTableResource;
LIST_ENTRY ExpFirmwareTableProviderListHead;
FAST_MUTEX ExpEnvironmentLock;
ERESOURCE ExpFirmwareTableResource;
LIST_ENTRY ExpFirmwareTableProviderListHead;
/* Copy the name to kernel space if necessary */
Status = ProbeAndCaptureUnicodeString(&WName, PreviousMode, VariableName);
/* Copy the name to kernel space if necessary */
Status = ProbeAndCaptureUnicodeString(&WName, PreviousMode, VariableName);
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
+ if (!NT_SUCCESS(Status)) return Status;
/* Convert the name to ANSI and release the captured UNICODE string */
Status = RtlUnicodeStringToAnsiString(&AName, &WName, TRUE);
/* Convert the name to ANSI and release the captured UNICODE string */
Status = RtlUnicodeStringToAnsiString(&AName, &WName, TRUE);
if (!NT_SUCCESS(Status)) return Status;
/* Allocate a buffer for the ANSI environment variable */
if (!NT_SUCCESS(Status)) return Status;
/* Allocate a buffer for the ANSI environment variable */
- AnsiValueBuffer = ExAllocatePoolWithTag(NonPagedPool, ValueBufferLength, 'pmeT');
+ AnsiValueBuffer = ExAllocatePoolWithTag(NonPagedPool, MAX_ENVVAL_SIZE, 'rvnE');
if (AnsiValueBuffer == NULL)
{
RtlFreeAnsiString(&AName);
if (AnsiValueBuffer == NULL)
{
RtlFreeAnsiString(&AName);
/* Get the environment variable and free the ANSI name */
Result = HalGetEnvironmentVariable(AName.Buffer,
/* Get the environment variable and free the ANSI name */
Result = HalGetEnvironmentVariable(AName.Buffer,
- (USHORT)ValueBufferLength,
AnsiValueBuffer);
RtlFreeAnsiString(&AName);
AnsiValueBuffer);
RtlFreeAnsiString(&AName);
Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, FALSE);
if (ReturnLength != NULL)
Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, FALSE);
if (ReturnLength != NULL)
*ReturnLength = WValue.Length;
*ReturnLength = WValue.Length;
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
}
/* Free the allocated ANSI value buffer */
}
/* Free the allocated ANSI value buffer */
- ExFreePoolWithTag(AnsiValueBuffer, 'pmeT');
+ ExFreePoolWithTag(AnsiValueBuffer, 'rvnE');