diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-16 21:21:14 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-16 21:21:14 +0000 |
commit | 81b4980e9ef358a169ea3720ccf65e3e8e2a0f87 (patch) | |
tree | fbbd99084c6f3a79eedc6c5d8448151dcae58dc0 /pkg/tcpip/link/rawfile | |
parent | 2cb2cbfc4a6eb66524410a318f603ed5051b04f8 (diff) | |
parent | 666397c5c82ee18a776491919312d19cfe6d4a07 (diff) |
Merge release-20200907.0-64-g666397c5c (automated)
Diffstat (limited to 'pkg/tcpip/link/rawfile')
-rw-r--r-- | pkg/tcpip/link/rawfile/errors.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/tcpip/link/rawfile/errors.go b/pkg/tcpip/link/rawfile/errors.go index a0a873c84..604868fd8 100644 --- a/pkg/tcpip/link/rawfile/errors.go +++ b/pkg/tcpip/link/rawfile/errors.go @@ -31,10 +31,12 @@ var translations [maxErrno]*tcpip.Error // *tcpip.Error. // // Valid, but unrecognized errnos will be translated to -// tcpip.ErrInvalidEndpointState (EINVAL). Panics on invalid errnos. +// tcpip.ErrInvalidEndpointState (EINVAL). func TranslateErrno(e syscall.Errno) *tcpip.Error { - if err := translations[e]; err != nil { - return err + if e > 0 && e < syscall.Errno(len(translations)) { + if err := translations[e]; err != nil { + return err + } } return tcpip.ErrInvalidEndpointState } |