summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/rawfile
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-09-16 21:21:14 +0000
committergVisor bot <gvisor-bot@google.com>2020-09-16 21:21:14 +0000
commit81b4980e9ef358a169ea3720ccf65e3e8e2a0f87 (patch)
treefbbd99084c6f3a79eedc6c5d8448151dcae58dc0 /pkg/tcpip/link/rawfile
parent2cb2cbfc4a6eb66524410a318f603ed5051b04f8 (diff)
parent666397c5c82ee18a776491919312d19cfe6d4a07 (diff)
Merge release-20200907.0-64-g666397c5c (automated)
Diffstat (limited to 'pkg/tcpip/link/rawfile')
-rw-r--r--pkg/tcpip/link/rawfile/errors.go8
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
}