summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-17 16:48:04 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-17 16:48:04 +0000
commita7713388a0ed188a380c51ed3901c8f42cbbce8d (patch)
tree0917748912e789754fdc5d473a96f7df35ca76ce
parenta9aaf01f53a4551abb18d23931ac76aeddda1841 (diff)
downloadhercules-a7713388a0ed188a380c51ed3901c8f42cbbce8d.tar.gz
hercules-a7713388a0ed188a380c51ed3901c8f42cbbce8d.tar.bz2
hercules-a7713388a0ed188a380c51ed3901c8f42cbbce8d.tar.xz
hercules-a7713388a0ed188a380c51ed3901c8f42cbbce8d.zip
* Fixed potential crash in IRC processing message with '%' using *printf.
* Fixed memory leaking caused by homun_data not freed when removed. * Minor adjustments to sign/unsign in script commands. modified Changelog-Trunk.txt modified src/map/irc.c modified src/map/script.c modified src/map/unit.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9245 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/irc.c5
-rw-r--r--src/map/script.c32
-rw-r--r--src/map/unit.c1
4 files changed, 22 insertions, 18 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 3c826bc73..432eece5f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/11/17
+ * Fixed potential crash in IRC processing message with '%' using *printf. [Lance]
+ * Fixed memory leaking caused by homun_data not freed when removed. [Lance]
* Fixed client not validating the chat-kick-request packet, which can cause
crashes. [Skotlex]
* Updated map_quit to handle removing of players who are not even
diff --git a/src/map/irc.c b/src/map/irc.c
index 46d1c3b95..498467ae7 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -63,9 +63,10 @@ int irc_connect_timer(int tid, unsigned int tick, int id, int data)
void irc_announce(char *buf)
{
char send_string[256];
- malloc_tsetdword(send_string,'\0',256);
+ // malloc_tsetdword(send_string,'\0',256); // NOT REQUIRED
- sprintf(send_string,"PRIVMSG %s :%s",irc_channel, buf);
+ sprintf(send_string,"PRIVMSG %s :",irc_channel);
+ strcat(send_string, buf);
irc_send(send_string);
}
diff --git a/src/map/script.c b/src/map/script.c
index 414181f98..650429bcc 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11988,10 +11988,10 @@ int buildin_setmobdata(struct script_state *st){
md->level = (unsigned short)value2;
break;
case 2:
- md->status.hp = value2;
+ md->status.hp = (unsigned int)value2;
break;
case 3:
- md->status.max_hp = value2;
+ md->status.max_hp = (unsigned int)value2;
break;
case 4:
md->master_id = value2;
@@ -12006,49 +12006,49 @@ int buildin_setmobdata(struct script_state *st){
md->bl.y = (short)value2;
break;
case 8:
- md->status.speed = (short)value2;
+ md->status.speed = (unsigned short)value2;
break;
case 9:
- md->status.mode = (short)value2;
+ md->status.mode = (unsigned short)value2;
break;
case 10:
md->special_state.ai = (unsigned int)value2;
break;
case 11:
- md->sc.option = (short)value2;
+ md->sc.option = (unsigned short)value2;
break;
case 12:
- md->vd->sex = value2;
+ md->vd->sex = (char)value2;
break;
case 13:
- md->vd->class_ = value2;
+ md->vd->class_ = (unsigned short)value2;
break;
case 14:
- md->vd->hair_style = (short)value2;
+ md->vd->hair_style = (unsigned short)value2;
break;
case 15:
- md->vd->hair_color = (short)value2;
+ md->vd->hair_color = (unsigned short)value2;
break;
case 16:
- md->vd->head_bottom = (short)value2;
+ md->vd->head_bottom = (unsigned short)value2;
break;
case 17:
- md->vd->head_mid = (short)value2;
+ md->vd->head_mid = (unsigned short)value2;
break;
case 18:
- md->vd->head_top = (short)value2;
+ md->vd->head_top = (unsigned short)value2;
break;
case 19:
- md->vd->cloth_color = (short)value2;
+ md->vd->cloth_color = (unsigned short)value2;
break;
case 20:
- md->vd->shield = value2;
+ md->vd->shield = (unsigned short)value2;
break;
case 21:
- md->vd->weapon = (short)value2;
+ md->vd->weapon = (unsigned short)value2;
break;
case 22:
- md->vd->shield = (short)value2;
+ md->vd->shield = (unsigned short)value2;
break;
case 23:
md->ud.dir = (unsigned char)value2;
diff --git a/src/map/unit.c b/src/map/unit.c
index 2f908cecf..f3b0562e8 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1837,6 +1837,7 @@ int unit_free(struct block_list *bl, int clrtype) {
intif_homunculus_requestdelete(hd->homunculus.hom_id);
if (sd) sd->status.hom_id = 0;
}
+ aFree(hd); // Remember to free it! [Lance]
if(sd) sd->hd = NULL;
}