Skip to content

Commit

Permalink
windows: use unsafe.Slice in (*RawSockaddrAny).Sockaddr on windows
Browse files Browse the repository at this point in the history
Same as CL 472035 did in package syscall.

Change-Id: I153dfaa19933a2707848e4183d6ca704c2800a0e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/472016
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
tklauser authored and gopherbot committed Feb 28, 2023
1 parent 6f25076 commit c10701f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions windows/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,7 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
for n < len(pp.Path) && pp.Path[n] != 0 {
n++
}
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
sa.Name = string(bytes)
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
return sa, nil

case AF_INET:
Expand Down

0 comments on commit c10701f

Please sign in to comment.