Browse Source

Fix missing error return checks and comment typos

Rod Hynes 1 year ago
parent
commit
4d52662004
3 changed files with 9 additions and 3 deletions
  1. 3 0
      psiphon/common/inproxy/broker.go
  2. 5 2
      psiphon/common/inproxy/webrtc.go
  3. 1 1
      psiphon/meekConn.go

+ 3 - 0
psiphon/common/inproxy/broker.go

@@ -349,6 +349,9 @@ func (b *Broker) HandleSessionPacket(
 	handleUnwrappedRequest := func(initiatorID ID, unwrappedRequestPayload []byte) ([]byte, error) {
 	handleUnwrappedRequest := func(initiatorID ID, unwrappedRequestPayload []byte) ([]byte, error) {
 
 
 		recordType, err := peekRecordPreambleType(unwrappedRequestPayload)
 		recordType, err := peekRecordPreambleType(unwrappedRequestPayload)
+		if err != nil {
+			return nil, errors.Trace(err)
+		}
 
 
 		var responsePayload []byte
 		var responsePayload []byte
 
 

+ 5 - 2
psiphon/common/inproxy/webrtc.go

@@ -1620,7 +1620,10 @@ func processSDPAddresses(
 		if err != nil {
 		if err != nil {
 			return nil, nil, errors.Trace(err)
 			return nil, nil, errors.Trace(err)
 		}
 		}
-		port, _ := strconv.Atoi(portStr)
+		port, err := strconv.Atoi(portStr)
+		if err != nil {
+			return nil, nil, errors.Trace(err)
+		}
 
 
 		// Only IPv4 port mapping addresses are supported due to the
 		// Only IPv4 port mapping addresses are supported due to the
 		// NewCandidateHost limitation noted below. It is expected that port
 		// NewCandidateHost limitation noted below. It is expected that port
@@ -1735,7 +1738,7 @@ func processSDPAddresses(
 				// network addresses misuse non-private IP ranges (so are
 				// network addresses misuse non-private IP ranges (so are
 				// technically not bogons). Instead of outright rejecting
 				// technically not bogons). Instead of outright rejecting
 				// SDPs containing unexpected GeoIP candidates, they are
 				// SDPs containing unexpected GeoIP candidates, they are
-				// instead stripped out and the the resulting filtered SDP is
+				// instead stripped out and the resulting filtered SDP is
 				// used.
 				// used.
 
 
 				if lookupGeoIP != nil {
 				if lookupGeoIP != nil {

+ 1 - 1
psiphon/meekConn.go

@@ -100,7 +100,7 @@ type MeekConfig struct {
 	// HTTP level; TLS and server certificate verification is required; the
 	// HTTP level; TLS and server certificate verification is required; the
 	// origin server may be any HTTP(S) server.
 	// origin server may be any HTTP(S) server.
 	//
 	//
-	// MeekModeWrappedPlaintextRoundTrip: is equivilent to
+	// MeekModeWrappedPlaintextRoundTrip: is equivalent to
 	// MeekModePlaintextRoundTrip, except skipping of server certificate
 	// MeekModePlaintextRoundTrip, except skipping of server certificate
 	// verification is permitted. In this mode, the caller is asserting that
 	// verification is permitted. In this mode, the caller is asserting that
 	// the HTTP plaintext payload is wrapped in its own transport security
 	// the HTTP plaintext payload is wrapped in its own transport security