Commit 9bf62783 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

syscall: fix nil pointer dereference in Getdirentries on 32-bit freebsd 12

Don't attempt to dereference basep if it's nil, just pass it to
getdirentries_freebsd12 as is.

Ported from x/sys/unix CL 183223

Change-Id: Id1c4e0eb6ff36dd39524da8194fed9a5957bce61
Reviewed-on: https://go-review.googlesource.com/c/go/+/183797Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent adf88837
......@@ -267,7 +267,7 @@ func Fstatfs(fd int, st *Statfs_t) (err error) {
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
if supportsABI(_ino64First) {
if unsafe.Sizeof(*basep) == 8 {
if basep == nil || unsafe.Sizeof(*basep) == 8 {
return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep)))
}
// The freebsd12 syscall needs a 64-bit base. On 32-bit machines
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment