aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-20 17:03:19 +0200
committerSimon Rozman <simon@rozman.si>2019-06-21 12:20:33 +0200
commite4831b2011b4da479aaaf0a0d5e48be7f6638ac7 (patch)
tree1c7826a1c2124c4c19fa15079b105b4cec0d0fac
parentSynchronize accesses to MiniportAdapterHandle (diff)
downloadwintun-e4831b2011b4da479aaaf0a0d5e48be7f6638ac7.tar.xz
wintun-e4831b2011b4da479aaaf0a0d5e48be7f6638ac7.zip
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>
-rw-r--r--wintun.c4
1 files 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;
}