diff options
author | Alexander Neumann <alexander.neumann@redteam-pentesting.de> | 2022-03-04 10:38:10 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-03-09 18:27:36 -0700 |
commit | ae6bc4dd64e149270a86d649c92728432a50945f (patch) | |
tree | 45cfb127f47c7794c2ab0b8e16988858ad41a739 | |
parent | 2cec4d1a62b31484665b97c6eacddc490f0794d2 (diff) |
tun/netstack: check error returned by SetDeadline()
Signed-off-by: Alexander Neumann <alexander.neumann@redteam-pentesting.de>
[Jason: don't wrap deadline error.]
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | tun/netstack/tun.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go index ebdd5f1..8b1bb7f 100644 --- a/tun/netstack/tun.go +++ b/tun/netstack/tun.go @@ -690,7 +690,10 @@ func (tnet *Net) exchange(ctx context.Context, server netip.Addr, q dnsmessage.Q return dnsmessage.Parser{}, dnsmessage.Header{}, err } if d, ok := ctx.Deadline(); ok && !d.IsZero() { - c.SetDeadline(d) + err := c.SetDeadline(d) + if err != nil { + return dnsmessage.Parser{}, dnsmessage.Header{}, err + } } var p dnsmessage.Parser var h dnsmessage.Header |