diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 2 | ||||
-rw-r--r-- | src/char/geoip.c | 22 | ||||
-rw-r--r-- | src/char/int_storage.c | 2 |
3 files changed, 14 insertions, 12 deletions
diff --git a/src/char/char.c b/src/char/char.c index d97cd33a9..d8d9d386e 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1147,7 +1147,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every struct s_friend tmp_friend; #ifdef HOTKEY_SAVING struct hotkey tmp_hotkey; - int hotkey_num; + int hotkey_num = 0; #endif unsigned int opt; int account_id; diff --git a/src/char/geoip.c b/src/char/geoip.c index 889958e16..5d3324ab2 100644 --- a/src/char/geoip.c +++ b/src/char/geoip.c @@ -145,18 +145,20 @@ void geoip_init(void) } // Search database type - fseek(db, -3l, SEEK_END); - for (i = 0; i < GEOIP_STRUCTURE_INFO_MAX_SIZE; i++) { - if (fread(delim, sizeof(delim[0]), 3, db) != 3) { - db_type = 0; - break; - } - if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) { - if (fread(&db_type, sizeof(db_type), 1, db) != 1) { + if (fseek(db, -3l, SEEK_END) != 0) { + db_type = 0; + } else { + for (i = 0; i < GEOIP_STRUCTURE_INFO_MAX_SIZE; i++) { + if (fread(delim, sizeof(delim[0]), 3, db) != 3) { db_type = 0; + break; + } + if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) { + if (fread(&db_type, sizeof(db_type), 1, db) != 1) { + db_type = 0; + } + break; } - break; - } else { if (fseek(db, -4l, SEEK_CUR) != 0) { db_type = 0; break; diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 7afafc406..2584be0cf 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -303,7 +303,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL); while( SQL_SUCCESS == SQL->StmtNextRow(stmt)) { - Assert_retb(i >= MAX_INVENTORY); + Assert_retb(i < MAX_INVENTORY); memcpy(&items[i],&item,sizeof(struct item)); i++; } |