Skip to content

Commit 2b8e414

Browse files
committed
Fix memory corruption with FFI backend
1 parent cb7a484 commit 2b8e414

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/fiddle/ffi_backend.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def self.from_native(value, ctx)
240240
def self.to_ptr(value)
241241
if value.is_a?(String)
242242
cptr = Pointer.malloc(value.bytesize)
243-
cptr.ffi_ptr.put_string(0, value)
243+
cptr.ffi_ptr.write_bytes(value)
244244
cptr
245245

246246
elsif value.is_a?(Array)

0 commit comments

Comments
 (0)