diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-31 00:00:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-09 11:52:33 +0300 |
commit | f6faa451fedff3c1ff7c82cb8b088edb9482239c (patch) | |
tree | 655d8c2cbb19aa6f767a078377602481d1521052 | |
parent | dab1fba3a88b9c5e86a778a29bd4d565fc937155 (diff) | |
download | hercules-f6faa451fedff3c1ff7c82cb8b088edb9482239c.tar.gz hercules-f6faa451fedff3c1ff7c82cb8b088edb9482239c.tar.bz2 hercules-f6faa451fedff3c1ff7c82cb8b088edb9482239c.tar.xz hercules-f6faa451fedff3c1ff7c82cb8b088edb9482239c.zip |
Add checks to int_homun.c
-rw-r--r-- | src/char/int_homun.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/char/int_homun.c b/src/char/int_homun.c index dd23261c2..9f91de252 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -15,6 +15,7 @@ #include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" +#include "../common/nullpo.h" #include "../common/showmsg.h" #include "../common/socket.h" #include "../common/sql.h" @@ -34,6 +35,7 @@ void inter_homunculus_sql_final(void) void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag) { + nullpo_retv(sh); WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd,0) = 0x3890; WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; @@ -53,6 +55,7 @@ void mapif_homunculus_deleted(int fd, int flag) void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) { + nullpo_retv(hd); WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd,0) = 0x3891; WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; @@ -81,6 +84,7 @@ void mapif_homunculus_saved(int fd, int account_id, bool flag) void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char* name) { + nullpo_retv(name); WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOW(fd, 0) = 0x3894; WFIFOL(fd, 2) = account_id; @@ -95,6 +99,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd) bool flag = true; char esc_name[NAME_LENGTH*2+1]; + nullpo_ret(hd); SQL->EscapeStringLen(inter->sql_handle, esc_name, hd->name, strnlen(hd->name, NAME_LENGTH)); if( hd->hom_id == 0 ) @@ -158,6 +163,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) char* data; size_t len; + nullpo_ret(hd); memset(hd, 0, sizeof(*hd)); if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `homun_id`,`char_id`,`class`,`prev_class`,`name`,`level`,`exp`,`intimacy`,`hunger`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hp`,`max_hp`,`sp`,`max_sp`,`skill_point`,`rename_flag`, `vaporize` FROM `%s` WHERE `homun_id`='%u'", homunculus_db, homun_id) ) @@ -247,6 +253,7 @@ bool mapif_homunculus_rename(char *name) { int i; + nullpo_ret(name); // Check Authorized letters/symbols in the name of the homun if( char_name_option == 1 ) {// only letters/symbols in char_name_letters are authorized |