summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-08 04:26:57 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-08 04:28:27 +0300
commit2d502ef94e09e5057f2868288d9054f8f0f39348 (patch)
treeb4563d4cfc8e9438913ea2cfd35bcb3ecd0d57d1
parent3064114926db1340f50292c40b3cedf18aabdd55 (diff)
downloadhercules-2d502ef94e09e5057f2868288d9054f8f0f39348.tar.gz
hercules-2d502ef94e09e5057f2868288d9054f8f0f39348.tar.bz2
hercules-2d502ef94e09e5057f2868288d9054f8f0f39348.tar.xz
hercules-2d502ef94e09e5057f2868288d9054f8f0f39348.zip
Add missing checks into pincode packets.
-rw-r--r--src/char/pincode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/char/pincode.c b/src/char/pincode.c
index 9f814b5ad..bca1b4394 100644
--- a/src/char/pincode.c
+++ b/src/char/pincode.c
@@ -68,6 +68,8 @@ void pincode_check(int fd, struct char_session_data* sd) {
char pin[5] = "\0\0\0\0";
nullpo_retv(sd);
+ if (strlen(sd->pincode) != 4)
+ return;
safestrncpy(pin, RFIFOP(fd, 6), sizeof(pin));
pincode->decrypt(sd->pincode_seed, pin);
if( pincode->compare( fd, sd, pin ) ){
@@ -99,6 +101,8 @@ void pincode_change(int fd, struct char_session_data* sd) {
char oldpin[5] = "\0\0\0\0", newpin[5] = "\0\0\0\0";
nullpo_retv(sd);
+ if (strlen(sd->pincode) != 4)
+ return;
safestrncpy(oldpin, RFIFOP(fd,6), sizeof(oldpin));
pincode->decrypt(sd->pincode_seed,oldpin);
if( !pincode->compare( fd, sd, oldpin ) )
@@ -115,6 +119,8 @@ void pincode_setnew(int fd, struct char_session_data* sd) {
char newpin[5] = "\0\0\0\0";
nullpo_retv(sd);
+ if (strlen(sd->pincode) == 4)
+ return;
safestrncpy(newpin, RFIFOP(fd,6), sizeof(newpin));
pincode->decrypt(sd->pincode_seed,newpin);
pincode->update( sd->account_id, newpin );