Skip to content

Commit

Permalink
udp: payload length parse fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yomimono committed Mar 22, 2017
1 parent 1f1da8e commit 2d77d05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/udp/udp_packet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Unmarshal = struct
Error "UDP header claimed a total length < the size of just the header"
else begin
let payload_len = length_from_header - sizeof_udp in
if payload_len > length_of_buffer
if payload_len > (length_of_buffer - sizeof_udp)
then Error (Printf.sprintf
"UDP header claimed a payload longer than the supplied buffer: %d vs %d."
payload_len length_of_buffer)
Expand Down

0 comments on commit 2d77d05

Please sign in to comment.