summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-08-05 11:21:27 +0200
committerHaru <haru@dotalux.com>2013-08-05 11:52:20 +0200
commitc1dca647670c1b55bcd66c82958fcd8180115fac (patch)
tree761622b352d1985c80d0fb70b73dbde9580e042b
parent3fc08ed5c02c15646808ed3b42995aaf5691a260 (diff)
downloadhercules-c1dca647670c1b55bcd66c82958fcd8180115fac.tar.gz
hercules-c1dca647670c1b55bcd66c82958fcd8180115fac.tar.bz2
hercules-c1dca647670c1b55bcd66c82958fcd8180115fac.tar.xz
hercules-c1dca647670c1b55bcd66c82958fcd8180115fac.zip
Improved reliability of the packet obfuscation key update function
Follow-up to 38b8bf0 Solves some edge cases where, depending on key and packet combination, the key may not be correctly updated and leads to a forced disconnection. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/clif.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index f9ea6e2c1..44df5b607 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17657,7 +17657,7 @@ int clif_parse(int fd) {
if ((int)RFIFOREST(fd) < packet_len)
return 0; // not enough data received to form the packet
- if( cmd != RFIFOW(fd, 0) ) {
+ if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) {
RFIFOW(fd, 0) = cmd;
if( sd ) {
sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; // Update key for the next packet