mirror of
https://github.com/tnodir/fort
synced 2024-11-15 01:36:22 +00:00
Driver: Drop too long path.
This commit is contained in:
parent
92762a5389
commit
a4502f7589
@ -1,6 +1,6 @@
|
||||
/* Windows IP Filter Log Buffer */
|
||||
|
||||
#define WIPF_BUFFER_SIZE 4 * 1024
|
||||
#define WIPF_BUFFER_SIZE 2 * 1024
|
||||
#define WIPF_BUFFER_SIZE_MAX 32 * 1024
|
||||
|
||||
#include "../wipflog.c"
|
||||
@ -36,12 +36,16 @@ wipf_buffer_write (PWIPF_BUFFER buf, UINT32 remote_ip, UINT64 pid,
|
||||
UINT32 path_len, const PVOID path,
|
||||
PIRP *irp, NTSTATUS *irp_status, ULONG_PTR *info)
|
||||
{
|
||||
const UINT32 len = sizeof(UINT32) + sizeof(UINT64)
|
||||
+ sizeof(UINT32) + path_len;
|
||||
UINT32 len = WIPF_LOG_SIZE(path_len);
|
||||
UINT32 size;
|
||||
KIRQL irq;
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
|
||||
if (len > WIPF_BUFFER_SIZE) {
|
||||
path_len = 0; /* drop too long path */
|
||||
len = WIPF_LOG_SIZE(0);
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&buf->lock, &irq);
|
||||
|
||||
/* Try to directly write to pending client */
|
||||
@ -64,10 +68,6 @@ wipf_buffer_write (PWIPF_BUFFER buf, UINT32 remote_ip, UINT64 pid,
|
||||
|
||||
size = buf->size;
|
||||
|
||||
if (len > WIPF_BUFFER_SIZE) {
|
||||
status = STATUS_INVALID_PARAMETER;
|
||||
goto end; /* drop too long path */
|
||||
}
|
||||
if (len > size - buf->top) {
|
||||
size *= 2;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
/* Windows IP Filter Log */
|
||||
|
||||
#define WIPF_LOG_SIZE(path_len) \
|
||||
(sizeof(UINT32) + sizeof(UINT64) + sizeof(UINT32) + (path_len))
|
||||
|
||||
|
||||
static void
|
||||
wipf_log_write (char *p, UINT32 remote_ip, UINT64 pid,
|
||||
UINT32 path_len, const char *path)
|
||||
|
Loading…
Reference in New Issue
Block a user