summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIbrahim Zidan <brahem@aotsw.com>2019-04-08 04:37:35 +0200
committerIbrahim Zidan <brahem@aotsw.com>2019-04-10 16:25:23 +0200
commit5410de9d04124ce34f58173d616c21088a1482ee (patch)
treee6fe7f8418133f9aed3fb33322e3a3c81cfdcc8f /src
parent37767f6505db9e7a4039621cfd77623b06d92606 (diff)
downloadhercules-5410de9d04124ce34f58173d616c21088a1482ee.tar.gz
hercules-5410de9d04124ce34f58173d616c21088a1482ee.tar.bz2
hercules-5410de9d04124ce34f58173d616c21088a1482ee.tar.xz
hercules-5410de9d04124ce34f58173d616c21088a1482ee.zip
Addition of missing nullpo check in clif_send and an assertion check for
zero/negatvie length values Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 0f8469e64..53c2c6b23 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -431,8 +431,13 @@ static int clif_send_actual(int fd, void *buf, int len)
*------------------------------------------*/
static bool clif_send(const void *buf, int len, struct block_list *bl, enum send_target type)
{
+ if (type != ALL_CLIENT)
+ nullpo_retr(false, bl);
+ nullpo_retr(false, buf);
+ Assert_retr(false, len > 0);
+
int i;
- struct map_session_data *sd, *tsd;
+ struct map_session_data *sd = BL_CAST(BL_PC, bl), *tsd;
struct party_data *p = NULL;
struct guild *g = NULL;
struct battleground_data *bgd = NULL;
@@ -440,11 +445,6 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send
struct s_mapiterator* iter;
int area_size;
- if( type != ALL_CLIENT )
- nullpo_ret(bl);
-
- sd = BL_CAST(BL_PC, bl);
-
if (sd != NULL && pc_isinvisible(sd)) {
if (type == AREA || type == BG || type == BG_AREA)
type = SELF;