Skip to content

Commit 63ac554

Browse files
authored
fix: take into account null terminated C strings (#132)
1 parent 867f8ef commit 63ac554

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

NativeScript/runtime/Interop.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@
174174
} else {
175175
v8::String::Utf8Value utf8Value(isolate, arg);
176176
value = strdup(*utf8Value);
177-
OneByteStringResource* resource = new OneByteStringResource(value, strArg->Length());
177+
auto length = strArg->Length() + 1;
178+
OneByteStringResource* resource = new OneByteStringResource(value, length);
178179
bool success = v8::String::NewExternalOneByte(isolate, resource).ToLocal(&arg);
179180
tns::Assert(success, isolate);
180181
}

0 commit comments

Comments
 (0)