From f6faa451fedff3c1ff7c82cb8b088edb9482239c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 31 Mar 2015 00:00:01 +0300 Subject: Add checks to int_homun.c --- src/char/int_homun.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/char') 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 -- cgit v1.2.3-60-g2f50