diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-02-05 08:50:40 -0800 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-02-08 15:31:27 -0800 |
commit | 5c832e44c3c61ad41506df0d283901aba6aea187 (patch) | |
tree | 08d45b505d04bdfd52bb38e4f52f62f6c5982cd2 /src/node_crypto.cc | |
parent | 2e8bb57fe37fd75323d3e3290be7264df97fe4dc (diff) | |
download | node-new-5c832e44c3c61ad41506df0d283901aba6aea187.tar.gz |
src: refactor buffer bounds checking
Consolidate buffer bounds checking logic into Buffer namespace and use
it consistently throughout the source.
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r-- | src/node_crypto.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 9a57b167a7..e23f1502ce 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1320,7 +1320,7 @@ Handle<Value> Connection::EncIn(const Arguments& args) { size_t off = args[1]->Int32Value(); size_t len = args[2]->Int32Value(); - if (off + len > buffer_length) { + if (!Buffer::IsWithinBounds(off, len, buffer_length)) { return ThrowException(Exception::Error( String::New("off + len > buffer.length"))); } @@ -1361,7 +1361,7 @@ Handle<Value> Connection::ClearOut(const Arguments& args) { size_t off = args[1]->Int32Value(); size_t len = args[2]->Int32Value(); - if (off + len > buffer_length) { + if (!Buffer::IsWithinBounds(off, len, buffer_length)) { return ThrowException(Exception::Error( String::New("off + len > buffer.length"))); } @@ -1437,7 +1437,7 @@ Handle<Value> Connection::EncOut(const Arguments& args) { size_t off = args[1]->Int32Value(); size_t len = args[2]->Int32Value(); - if (off + len > buffer_length) { + if (!Buffer::IsWithinBounds(off, len, buffer_length)) { return ThrowException(Exception::Error( String::New("off + len > buffer.length"))); } @@ -1471,7 +1471,7 @@ Handle<Value> Connection::ClearIn(const Arguments& args) { size_t off = args[1]->Int32Value(); size_t len = args[2]->Int32Value(); - if (off + len > buffer_length) { + if (!Buffer::IsWithinBounds(off, len, buffer_length)) { return ThrowException(Exception::Error( String::New("off + len > buffer.length"))); } |