From f8206b9bcc2976c719ccc39ff59ff3216859b286 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Thu, 18 Nov 2021 16:57:24 -0800 Subject: [PATCH] syscall: fix array size for mmap slice creation --- src/syscall/syscall_libc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syscall/syscall_libc.go b/src/syscall/syscall_libc.go index 4767703a..72e488d5 100644 --- a/src/syscall/syscall_libc.go +++ b/src/syscall/syscall_libc.go @@ -85,7 +85,7 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e if addr == unsafe.Pointer(^uintptr(0)) { return nil, getErrno() } - return (*[30]byte)(addr)[:length], nil + return (*[1 << 30]byte)(addr)[:length:length], nil } func Mprotect(b []byte, prot int) (err error) {