summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-05-17 02:35:40 +0200
committerHaru <haru@dotalux.com>2015-05-17 02:35:53 +0200
commitb9a8ad743a78d5053482cb4d47d2795252ec9095 (patch)
tree40d10510054cd3dd254c366ccbe550817cb3e4ec /src/char
parentb2b597c523f19fbacaf052117d47f254483c6e0e (diff)
downloadhercules-b9a8ad743a78d5053482cb4d47d2795252ec9095.tar.gz
hercules-b9a8ad743a78d5053482cb4d47d2795252ec9095.tar.bz2
hercules-b9a8ad743a78d5053482cb4d47d2795252ec9095.tar.xz
hercules-b9a8ad743a78d5053482cb4d47d2795252ec9095.zip
Fixed some issues detected by coverity scan
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c2
-rw-r--r--src/char/geoip.c22
-rw-r--r--src/char/int_storage.c2
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++;
}