mirror of
https://github.com/tnodir/fort
synced 2024-11-15 11:25:08 +00:00
Driver: PsTree: Check service name's length
This commit is contained in:
parent
4e4f0b5efd
commit
f85c215529
@ -5,6 +5,22 @@
|
|||||||
#include "fortcb.h"
|
#include "fortcb.h"
|
||||||
#include "fortutl.h"
|
#include "fortutl.h"
|
||||||
|
|
||||||
|
#define FORT_PSTREE_NAME_LEN_MAX (64 * sizeof(WCHAR))
|
||||||
|
|
||||||
|
typedef struct fort_psnode
|
||||||
|
{
|
||||||
|
UINT16 next_index;
|
||||||
|
UINT16 prev_index;
|
||||||
|
|
||||||
|
UINT16 parent_index;
|
||||||
|
UINT16 child_index;
|
||||||
|
|
||||||
|
UINT16 name_index;
|
||||||
|
UINT16 flags;
|
||||||
|
|
||||||
|
UINT32 process_id;
|
||||||
|
} FORT_PSNODE, *PFORT_PSNODE;
|
||||||
|
|
||||||
static BOOL fort_pstree_svchost_check(
|
static BOOL fort_pstree_svchost_check(
|
||||||
PCUNICODE_STRING path, PCUNICODE_STRING commandLine, PUNICODE_STRING serviceName)
|
PCUNICODE_STRING path, PCUNICODE_STRING commandLine, PUNICODE_STRING serviceName)
|
||||||
{
|
{
|
||||||
@ -32,8 +48,12 @@ static BOOL fort_pstree_svchost_check(
|
|||||||
endp = (PCWCHAR) ((PCHAR) commandLine->Buffer + commandLine->Length);
|
endp = (PCWCHAR) ((PCHAR) commandLine->Buffer + commandLine->Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
serviceName->Length = (USHORT) ((PCHAR) endp - (PCHAR) argp);
|
const USHORT nameLen = (USHORT) ((PCHAR) endp - (PCHAR) argp);
|
||||||
serviceName->MaximumLength = serviceName->Length;
|
if (nameLen >= FORT_PSTREE_NAME_LEN_MAX)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
serviceName->Length = nameLen;
|
||||||
|
serviceName->MaximumLength = nameLen;
|
||||||
serviceName->Buffer = argp;
|
serviceName->Buffer = argp;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user