From e4831b2011b4da479aaaf0a0d5e48be7f6638ac7 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 20 Jun 2019 17:03:19 +0200 Subject: [PATCH] Use ULONG instead of ptrdiff_t for length measurement Even though we're comparing this with a ptrdiff_t in one place and adding it to a void* in another place, it's still a length and as such should be a size_t, which I guess in our weird universe here is a ULONG. Signed-off-by: Jason A. Donenfeld --- wintun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wintun.c b/wintun.c index 8476533..aba7f2c 100644 --- a/wintun.c +++ b/wintun.c @@ -685,8 +685,8 @@ static NTSTATUS TunDispatchWrite(_Inout_ TUN_CTX *ctx, _Inout_ IRP *Irp) status = STATUS_INVALID_USER_BUFFER; goto cleanup_nbl_queues; } - ptrdiff_t p_size = TunPacketAlign(sizeof(TUN_PACKET) + p->Size); - if (b_end - b < p_size) { + ULONG p_size = TunPacketAlign(sizeof(TUN_PACKET) + p->Size); + if (b_end - b < (ptrdiff_t)p_size) { status = STATUS_INVALID_USER_BUFFER; goto cleanup_nbl_queues; }