diff options
| author | mat <github@matdoes.dev> | 2022-04-30 16:56:59 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-30 16:56:59 -0500 |
| commit | 7f9463320f75b4a754ef9f52da9a9fbb4f36fe56 (patch) | |
| tree | 66c12c6cb0fbbbd2f4779ee07988702b64bd7907 | |
| parent | 153b5b45e42a031e9ee7dd2764840b07ce1cb47b (diff) | |
| download | azalea-drasl-7f9463320f75b4a754ef9f52da9a9fbb4f36fe56.tar.xz | |
fix error that happens in linux + release mode
| -rwxr-xr-x | azalea-protocol/src/read.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs index 51224499..2a74d8de 100755 --- a/azalea-protocol/src/read.rs +++ b/azalea-protocol/src/read.rs @@ -118,8 +118,12 @@ where let polled = self.as_mut().stream.as_mut().poll_read(cx, buf); match polled { Poll::Ready(r) => { - if let Some(cipher) = self.as_mut().cipher.get_mut() { - azalea_auth::encryption::decrypt_packet(cipher, buf.initialized_mut()); + // if we don't check for the remaining then we decrypt big packets incorrectly + // (but only on linux and release mode for some reason LMAO) + if buf.remaining() == 0 { + if let Some(cipher) = self.as_mut().cipher.get_mut() { + azalea_auth::encryption::decrypt_packet(cipher, buf.filled_mut()); + } } match r { Ok(()) => Poll::Ready(Ok(())), |
