From 5410de9d04124ce34f58173d616c21088a1482ee Mon Sep 17 00:00:00 2001 From: Ibrahim Zidan Date: Mon, 8 Apr 2019 04:37:35 +0200 Subject: Addition of missing nullpo check in clif_send and an assertion check for zero/negatvie length values Signed-off-by: Ibrahim Zidan --- src/map/clif.c | 12 ++++++------ 1 file 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; -- cgit v1.2.3-70-g09d2