mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-29 05:16:30 -04:00
unix: 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. Change-Id: I043a9ee9262e6333c35fd9ecc52694c8fd2de9f6 Reviewed-on: https://go-review.googlesource.com/c/sys/+/183223 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
4d873483be
commit
d432491b91
@@ -362,7 +362,7 @@ func Getdents(fd int, buf []byte) (n int, 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
|
||||
|
||||
Reference in New Issue
Block a user