Created
July 13, 2015 17:42
-
-
Save matthewarkin/1f6580660853778c6381 to your computer and use it in GitHub Desktop.
Couchnode buffer patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/operations.cc b/src/operations.cc | |
index 3e80f02..96086d0 100644 | |
--- a/src/operations.cc | |
+++ b/src/operations.cc | |
@@ -38,7 +38,11 @@ static const int PS_QUERY = 6; | |
template <int X, size_t Y, typename T, typename V> | |
bool _ParseString(const T** val, V* nval, Handle<Value> key) { | |
static char keyBuffer[Y]; | |
- *val = (char*)_NanRawString(key, Nan::UTF8, (size_t*)nval, | |
+ v8::Local<v8::String> keyStr = key->ToString(); | |
+ if (keyStr->Utf8Length() >= Y) { | |
+ return false; | |
+ } | |
+ *val = (char*)_NanRawString(keyStr, Nan::UTF8, (size_t*)nval, | |
keyBuffer, Y, v8::String::NO_OPTIONS); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment