Skip to content

Commit

Permalink
fix: take into account null terminated C strings (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
darind authored Nov 18, 2021
1 parent 867f8ef commit 63ac554
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NativeScript/runtime/Interop.mm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@
} else {
v8::String::Utf8Value utf8Value(isolate, arg);
value = strdup(*utf8Value);
OneByteStringResource* resource = new OneByteStringResource(value, strArg->Length());
auto length = strArg->Length() + 1;
OneByteStringResource* resource = new OneByteStringResource(value, length);
bool success = v8::String::NewExternalOneByte(isolate, resource).ToLocal(&arg);
tns::Assert(success, isolate);
}
Expand Down

0 comments on commit 63ac554

Please sign in to comment.