From a3c4d675ba19df385be5d1e3966c61de7186da57 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 17 Jan 2015 20:18:49 -0200 Subject: 27 Fixes Addressing out of bounds read/write, pointless null checks on already deferenced variables. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind --- src/map/clif.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 31f7961d5..ae6b6d939 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5706,8 +5706,7 @@ void clif_broadcast(struct block_list* bl, const char* mes, size_t len, int type memcpy(WBUFP(buf, 4 + lp), mes, len); clif->send(buf, WBUFW(buf,2), bl, target); - if (buf) - aFree(buf); + aFree(buf); } /*========================================== @@ -5753,8 +5752,7 @@ void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigne memcpy(WBUFP(buf,16), mes, len); clif->send(buf, WBUFW(buf,2), bl, target); - if (buf) - aFree(buf); + aFree(buf); } @@ -16299,6 +16297,7 @@ void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name { struct map_session_data *sd; unsigned char *buf; + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == NULL ) return; @@ -16311,8 +16310,7 @@ void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name memcpy(WBUFP(buf,32), mes, len); clif->send(buf,WBUFW(buf,2), &sd->bl, BG); - if( buf ) - aFree(buf); + aFree(buf); } @@ -18816,10 +18814,12 @@ static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) pos = va_arg(va, int); - if( pos == 0xFFFF ) /* nothing more to do */ + va_end(va); + + if( pos == 0xFFFF ) { /* nothing more to do */ return; + } - va_end(va); va_start(va,len); func = va_arg(va,pFunc); -- cgit v1.2.3-70-g09d2