commit 8af304d1828d2c735c612c1d338bc6ac4b0f40c8
Author: David Fifield <[email protected]>
Date:   Tue Mar 5 14:05:10 2019 -0700

    Check for error of SetDeadline in DialOr.
    
    https://bugs.torproject.org/15826
---
 pt.go | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/pt.go b/pt.go
index cc0ed8c..c2895b8 100644
--- a/pt.go
+++ b/pt.go
@@ -932,7 +932,11 @@ func DialOr(info *ServerInfo, addr, methodName string) 
(*net.TCPConn, error) {
        if err != nil {
                return nil, err
        }
-       s.SetDeadline(time.Now().Add(5 * time.Second))
+       err = s.SetDeadline(time.Now().Add(5 * time.Second))
+       if err != nil {
+               s.Close()
+               return nil, err
+       }
        err = extOrPortAuthenticate(s, info)
        if err != nil {
                s.Close()
@@ -943,7 +947,11 @@ func DialOr(info *ServerInfo, addr, methodName string) 
(*net.TCPConn, error) {
                s.Close()
                return nil, err
        }
-       s.SetDeadline(time.Time{})
+       err = s.SetDeadline(time.Time{})
+       if err != nil {
+               s.Close()
+               return nil, err
+       }
 
        return s, nil
 }



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to