do not accept negative buffer length

This commit is contained in:
Vincent Bernardoff 2016-10-07 13:46:58 +02:00 committed by Grégoire Henry
parent 4a7eb60631
commit 17cb9ccc4a

View File

@ -194,7 +194,7 @@ let read descr limit =
return None return None
else else
let len = Int32.to_int (BE.get_int32 szbuf 0) + 4 in let len = Int32.to_int (BE.get_int32 szbuf 0) + 4 in
if len > limit then if len < 0 || len > limit then
return None return None
else else
let buf = MBytes.create len in let buf = MBytes.create len in