Skip to content

Commit

Permalink
fix shadowsocks2022 non-EIH UDP panic
Browse files Browse the repository at this point in the history
  • Loading branch information
dyhkwong authored and xiaokangwang committed May 5, 2024
1 parent 8b8a786 commit 005812c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions proxy/shadowsocks2022/method_aes128gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions proxy/shadowsocks2022/method_aes256gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 005812c

Please sign in to comment.