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 <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-06-20 17:03:19 +02:00 committed by Simon Rozman
parent dea5bfa2d2
commit e4831b2011

View File

@ -685,8 +685,8 @@ static NTSTATUS TunDispatchWrite(_Inout_ TUN_CTX *ctx, _Inout_ IRP *Irp)
status = STATUS_INVALID_USER_BUFFER; status = STATUS_INVALID_USER_BUFFER;
goto cleanup_nbl_queues; goto cleanup_nbl_queues;
} }
ptrdiff_t p_size = TunPacketAlign(sizeof(TUN_PACKET) + p->Size); ULONG p_size = TunPacketAlign(sizeof(TUN_PACKET) + p->Size);
if (b_end - b < p_size) { if (b_end - b < (ptrdiff_t)p_size) {
status = STATUS_INVALID_USER_BUFFER; status = STATUS_INVALID_USER_BUFFER;
goto cleanup_nbl_queues; goto cleanup_nbl_queues;
} }