summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-27 03:43:29 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-27 19:09:23 +0300
commite268c30959b81850ce85124aafc57398d2cb47c6 (patch)
treefcd5a905f4c896e869599412afc6c8ac1a2e523a /src/char
parenteda3e91684c6364b55d740f0c78a669705b867a6 (diff)
downloadhercules-e268c30959b81850ce85124aafc57398d2cb47c6.tar.gz
hercules-e268c30959b81850ce85124aafc57398d2cb47c6.tar.bz2
hercules-e268c30959b81850ce85124aafc57398d2cb47c6.tar.xz
hercules-e268c30959b81850ce85124aafc57398d2cb47c6.zip
Ignore invalid pincode.
Diffstat (limited to 'src/char')
-rw-r--r--src/char/pincode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/char/pincode.c b/src/char/pincode.c
index fc1a4c037..b1d41bc2d 100644
--- a/src/char/pincode.c
+++ b/src/char/pincode.c
@@ -172,8 +172,11 @@ void pincode_decrypt(unsigned int userSeed, char* pin) {
}
}
- for( i = 0; i < 4; i++ ){
- pin[i] = tab[pin[i] - '0'];
+ for (i = 0; i < 4; i++ ) {
+ if (pin[i] < '0' || pin[i] > '9')
+ pin[i] = '0';
+ else
+ pin[i] = tab[pin[i] - '0'];
}
sprintf(pin, "%d%d%d%d", pin[0], pin[1], pin[2], pin[3]);