فهرست منبع

fix shadowsocks2022 non-EIH UDP panic

dyhkwong 2 سال پیش
والد
کامیت
005812cd37
2فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 3 0
      proxy/shadowsocks2022/method_aes128gcm.go
  2. 3 0
      proxy/shadowsocks2022/method_aes256gcm.go

+ 3 - 0
proxy/shadowsocks2022/method_aes128gcm.go

@@ -62,6 +62,9 @@ func (a AES128GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, deriva
 		}
 		return aead
 	}
+	if len(ipsk) == 0 {
+		return NewAESUDPClientPacketProcessor(reqSeparateHeaderCipher, respSeparateHeaderCipher, getPacketAEAD, nil), nil
+	}
 	eihGenerator := newAESEIHGeneratorContainer(len(ipsk), psk, ipsk)
 	getEIH := func(mask []byte) ExtensibleIdentityHeaders {
 		eih, err := eihGenerator.GenerateEIHUDP(derivation, a, mask)

+ 3 - 0
proxy/shadowsocks2022/method_aes256gcm.go

@@ -62,6 +62,9 @@ func (a AES256GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, deriva
 		}
 		return aead
 	}
+	if len(ipsk) == 0 {
+		return NewAESUDPClientPacketProcessor(reqSeparateHeaderCipher, respSeparateHeaderCipher, getPacketAEAD, nil), nil
+	}
 	eihGenerator := newAESEIHGeneratorContainer(len(ipsk), psk, ipsk)
 	getEIH := func(mask []byte) ExtensibleIdentityHeaders {
 		eih, err := eihGenerator.GenerateEIHUDP(derivation, a, mask)