summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-05 21:06:46 +0200
committerHaru <haru@dotalux.com>2014-09-05 21:10:06 +0200
commit41e2a782a7c86140a2440b67258c428e09113195 (patch)
treeb4d188a43721412381874e414ee73a133114fd83 /src
parentbb93fb127f79f8c4ed443c0a50d5de24a6ca5f1c (diff)
downloadhercules-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>
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c20
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);