summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/unix.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2002-07-12 09:47:54 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2002-07-12 09:47:54 +0000
commitede12e6163058650508a0fbb08177ab4ee4daf02 (patch)
tree6241a927f8d50e772b0cd74ba83e5cdc0d456c5c /otherlibs/win32unix/unix.ml
parent4865d98f29e1f648c7b45a9304dff12604d6abb8 (diff)
Remplacement des tests ofs + len > length par ofs > len - length, pour eviter le debordement lors de l'addition (PR#1229)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4993 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/unix.ml')
-rw-r--r--otherlibs/win32unix/unix.ml12
1 files changed, 6 insertions, 6 deletions
diff --git a/otherlibs/win32unix/unix.ml b/otherlibs/win32unix/unix.ml
index 5231507e1..5bec474e2 100644
--- a/otherlibs/win32unix/unix.ml
+++ b/otherlibs/win32unix/unix.ml
@@ -184,11 +184,11 @@ external unsafe_write : file_descr -> string -> int -> int -> int
= "unix_write"
let read fd buf ofs len =
- if len < 0 || ofs + len > String.length buf
+ if ofs < 0 || len < 0 || ofs > String.length buf - len
then invalid_arg "Unix.read"
else unsafe_read fd buf ofs len
let write fd buf ofs len =
- if len < 0 || ofs + len > String.length buf
+ if ofs < 0 || len < 0 || ofs > String.length buf - len
then invalid_arg "Unix.write"
else unsafe_write fd buf ofs len
@@ -549,19 +549,19 @@ external unsafe_sendto :
= "unix_sendto" "unix_sendto_native"
let recv fd buf ofs len flags =
- if len < 0 || ofs + len > String.length buf
+ if ofs < 0 || len < 0 || ofs > String.length buf - len
then invalid_arg "Unix.recv"
else unsafe_recv fd buf ofs len flags
let recvfrom fd buf ofs len flags =
- if len < 0 || ofs + len > String.length buf
+ if ofs < 0 || len < 0 || ofs > String.length buf - len
then invalid_arg "Unix.recvfrom"
else unsafe_recvfrom fd buf ofs len flags
let send fd buf ofs len flags =
- if len < 0 || ofs + len > String.length buf
+ if ofs < 0 || len < 0 || ofs > String.length buf - len
then invalid_arg "Unix.send"
else unsafe_send fd buf ofs len flags
let sendto fd buf ofs len flags addr =
- if len < 0 || ofs + len > String.length buf
+ if ofs < 0 || len < 0 || ofs > String.length buf - len
then invalid_arg "Unix.sendto"
else unsafe_sendto fd buf ofs len flags addr