diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-05 21:06:46 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2014-09-05 21:10:06 +0200 |
commit | 41e2a782a7c86140a2440b67258c428e09113195 (patch) | |
tree | b4d188a43721412381874e414ee73a133114fd83 | |
parent | bb93fb127f79f8c4ed443c0a50d5de24a6ca5f1c (diff) | |
download | hercules-41e2a782a7c86140a2440b67258c428e09113195.tar.gz hercules-41e2a782a7c86140a2440b67258c428e09113195.tar.bz2 hercules-41e2a782a7c86140a2440b67258c428e09113195.tar.xz hercules-41e2a782a7c86140a2440b67258c428e09113195.zip |
Improved some FIFOSD checks in char_parse.
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/char/char.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/char/char.c b/src/char/char.c index 9abb17257..abebc5ff9 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -4749,8 +4749,7 @@ int parse_char(int fd) // checks the entered pin case 0x8b8: - if( RFIFOREST(fd) < 10 ) - return 0; + FIFOSD_CHECK(10); if( RFIFOL(fd,2) == sd->account_id ) pincode->check( fd, sd ); @@ -4760,8 +4759,8 @@ int parse_char(int fd) // request for PIN window case 0x8c5: - if( RFIFOREST(fd) < 6 ) - return 0; + FIFOSD_CHECK(6); + if( RFIFOL(fd,2) == sd->account_id ) pincode->sendstate( fd, sd, PINCODE_NOTSET ); @@ -4770,8 +4769,8 @@ int parse_char(int fd) // pincode change request case 0x8be: - if( RFIFOREST(fd) < 14 ) - return 0; + FIFOSD_CHECK(14); + if( RFIFOL(fd,2) == sd->account_id ) pincode->change( fd, sd ); @@ -4780,8 +4779,8 @@ int parse_char(int fd) // activate PIN system and set first PIN case 0x8ba: - if( RFIFOREST(fd) < 10 ) - return 0; + FIFOSD_CHECK(10); + if( RFIFOL(fd,2) == sd->account_id ) pincode->setnew( fd, sd ); RFIFOSKIP(fd,10); @@ -4789,9 +4788,8 @@ int parse_char(int fd) /* 0x8d4 <from>.W <to>.W <unused>.W (2+2+2+2) */ case 0x8d4: - if( RFIFOREST(fd) < 8 ) - return 0; - else { + FIFOSD_CHECK(8); + { bool ret; ret = char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); WFIFOHEAD(fd, 8); |