mirror of
https://github.com/reactos/reactos.git
synced 2026-06-10 01:42:56 +08:00
[NTOSKRNL] Unify buffer size calculation in FsRtlIs{Name,Dbcs}InExpression
It better captures the intent now in FsRtlIsNameInExpressionPrivate and fixes a slight overallotion by 4 bytes in FsRtlIsDbcsInExpression. While at it, use the ANSI_DOS_DOT macro in the Dbcs version. CORE-15902
This commit is contained in:
committed by
Pierre Schweitzer
parent
6eadbfb7e7
commit
695e00fbbd
@@ -291,7 +291,7 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
|
||||
ASSERT((OldBackTracking == BackTrackingBuffer) || (OldBackTracking == OldBackTrackingBuffer));
|
||||
|
||||
/* Calculate buffer size */
|
||||
BackTrackingBufferSize = (Expression->Length + 1) * 2;
|
||||
BackTrackingBufferSize = Expression->Length * 2 + 1;
|
||||
|
||||
/* Allocate memory for both back-tracking buffers */
|
||||
AllocatedBuffer = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
|
||||
@@ -386,7 +386,7 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
|
||||
continue;
|
||||
}
|
||||
/* Check DOS_DOT */
|
||||
else if (ExpressionChar == DOS_DOT)
|
||||
else if (ExpressionChar == ANSI_DOS_DOT)
|
||||
{
|
||||
if (EndOfName) continue;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
|
||||
ASSERT((OldBackTracking == BackTrackingBuffer) || (OldBackTracking == OldBackTrackingBuffer));
|
||||
|
||||
/* Calculate buffer size */
|
||||
BackTrackingBufferSize = Expression->Length + 1;
|
||||
BackTrackingBufferSize = Expression->Length / sizeof(WCHAR) * 2 + 1;
|
||||
|
||||
/* Allocate memory for both back-tracking buffers */
|
||||
AllocatedBuffer = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
|
||||
|
||||
Reference in New Issue
Block a user