Browse Source

Check buffer length using string length

+ Utf8Length is really slow but has the same semantics in this case
v0.7.4-release
Sean Braithwaite 14 years ago
committed by Ryan Dahl
parent
commit
fcc38129a3
  1. 2
      src/node_buffer.cc

2
src/node_buffer.cc

@ -406,7 +406,7 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
size_t offset = args[1]->Uint32Value();
if (s->Utf8Length() > 0 && offset >= buffer->length_) {
if (s->Length() > 0 && offset >= buffer->length_) {
return ThrowException(Exception::TypeError(String::New(
"Offset is out of bounds")));
}

Loading…
Cancel
Save