summaryrefslogtreecommitdiffstats
path: root/stdlib/buffer.ml
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/buffer.ml')
-rw-r--r--stdlib/buffer.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/buffer.ml b/stdlib/buffer.ml
index 855c81d61..e31b7b80a 100644
--- a/stdlib/buffer.ml
+++ b/stdlib/buffer.ml
@@ -56,7 +56,7 @@ let add_char b c =
b.position <- pos + 1
let add_substring b s offset len =
- if offset < 0 || len < 0 || offset + len > String.length s
+ if offset < 0 || len < 0 || offset > String.length s - len
then invalid_arg "Buffer.add_substring";
let new_position = b.position + len in
if new_position > b.length then resize b len;