diff options
author | shennetsind <ind@henn.et> | 2015-01-17 20:18:49 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2015-01-17 20:18:49 -0200 |
commit | a3c4d675ba19df385be5d1e3966c61de7186da57 (patch) | |
tree | 45b4a026a758afb1a54387cdadb91d55eba621f8 /src/map/clif.c | |
parent | 3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a (diff) | |
download | hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.tar.gz hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.tar.bz2 hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.tar.xz hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.zip |
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 <ind@henn.et>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 16 |
1 files changed, 8 insertions, 8 deletions
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); |