diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-08 00:50:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-08 00:50:47 +0300 |
commit | 45b2d8b7858c22e80457ebc4e3732e104b48bcb1 (patch) | |
tree | eef8f3d293e55db780269f4319195c17aafebe42 | |
parent | 10660a9ee48b07e932ed8c5a1a8e29dea1023388 (diff) | |
download | hercules-45b2d8b7858c22e80457ebc4e3732e104b48bcb1.tar.gz hercules-45b2d8b7858c22e80457ebc4e3732e104b48bcb1.tar.bz2 hercules-45b2d8b7858c22e80457ebc4e3732e104b48bcb1.tar.xz hercules-45b2d8b7858c22e80457ebc4e3732e104b48bcb1.zip |
Fix crashes if from login table can be read NULL field.
-rw-r--r-- | src/login/account_sql.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/login/account_sql.c b/src/login/account_sql.c index 195a10233..1e19b5a37 100644 --- a/src/login/account_sql.c +++ b/src/login/account_sql.c @@ -606,9 +606,9 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc SQL->GetData(sql_handle, 7, &data, NULL); acc->unban_time = atol(data); SQL->GetData(sql_handle, 8, &data, NULL); acc->expiration_time = atol(data); SQL->GetData(sql_handle, 9, &data, NULL); acc->logincount = (unsigned int)strtoul(data, NULL, 10); - SQL->GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data, sizeof(acc->lastlogin)); + SQL->GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data != NULL ? data : "", sizeof(acc->lastlogin)); SQL->GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip)); - SQL->GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data, sizeof(acc->birthdate)); + SQL->GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data != NULL ? data : "", sizeof(acc->birthdate)); SQL->GetData(sql_handle, 13, &data, NULL); acc->char_slots = (uint8)atoi(data); SQL->GetData(sql_handle, 14, &data, NULL); safestrncpy(acc->pincode, data, sizeof(acc->pincode)); SQL->GetData(sql_handle, 15, &data, NULL); acc->pincode_change = (unsigned int)atol(data); |