From ce54c5bc3d744f19fd5b95590be464cbd67c04b4 Mon Sep 17 00:00:00 2001 From: Vincent Bernardoff Date: Tue, 18 Oct 2016 14:08:42 +0200 Subject: [PATCH] netbits: read len as a uint16 --- src/node/net/netbits.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/net/netbits.ml b/src/node/net/netbits.ml index 494fa8644..f8a262aec 100644 --- a/src/node/net/netbits.ml +++ b/src/node/net/netbits.ml @@ -142,7 +142,7 @@ let of_raw buf = decode items (offset + 8) stop | 0x04 -> if_remains offset 2 @@ fun () -> - let len = BE.get_int16 buf offset in + let len = BE.get_uint16 buf offset in let offset = offset + 2 in if_remains offset len @@ fun () -> let items = B (MBytes.sub buf offset len) :: items in @@ -153,7 +153,7 @@ let of_raw buf = decode items (offset + 8) stop | 0x06 -> if_remains offset 2 @@ fun () -> - let len = BE.get_int16 buf offset in + let len = BE.get_uint16 buf offset in let offset = offset + 2 in if_remains offset len @@ fun () -> begin match decode [] offset (offset + len) with @@ -162,7 +162,7 @@ let of_raw buf = end | 0x07 -> if_remains offset 2 @@ fun () -> - let len = BE.get_int16 buf offset in + let len = BE.get_uint16 buf offset in let offset = offset + 2 in if_remains offset len @@ fun () -> let items = C (MBytes.substring buf offset len) :: items in