From 8d1f1186caf227edcd33dc60295b2ff50189dacc Mon Sep 17 00:00:00 2001 From: kriskowal Date: Fri, 30 Apr 2010 17:30:14 -0700 Subject: [PATCH] Fixed/Completed buffer copy range checks. --- src/node_buffer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 62c667b40c..d757b9623c 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -262,17 +262,17 @@ Handle Buffer::Copy(const Arguments &args) { "sourceEnd < sourceStart"))); } - if (target_start >= target->length()) { + if (target_start < 0 || target_start > target->length()) { return ThrowException(Exception::Error(String::New( "targetStart out of bounds"))); } - if (source_start >= source->length()) { + if (source_start < 0 || source_start > source->length()) { return ThrowException(Exception::Error(String::New( "sourceStart out of bounds"))); } - if (source_end > source->length()) { + if (source_end < 0 || source_end > source->length()) { return ThrowException(Exception::Error(String::New( "sourceEnd out of bounds"))); }