diff --git a/call_test.go b/call_test.go index b780424..3e39ab2 100644 --- a/call_test.go +++ b/call_test.go @@ -177,6 +177,15 @@ func TestCallSupportsCUintptrArgument(t *testing.T) { } } +func TestCallSupportsByteSliceArgument(t *testing.T) { + t.Parallel() + + payload := []byte("agent") + if err := Call(callSumLengthFunction(), payload, SizeT(len(payload))); err != nil { + t.Fatalf("expected success, got %v", err) + } +} + func TestErrnoMapping(t *testing.T) { t.Parallel() diff --git a/string_conversion.go b/string_conversion.go index d924378..cb97429 100644 --- a/string_conversion.go +++ b/string_conversion.go @@ -819,6 +819,11 @@ func toSyscallArg(value interface{}) (uintptr, bool) { return 0, true } return 0, false + case []byte: + if len(typed) == 0 { + return 0, true + } + return uintptr(unsafe.Pointer(&typed[0])), true } }