summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-06 19:58:33 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-06 20:31:08 +0300
commit15bb994898c212d3e02f404aa970a950d21a6554 (patch)
tree2fb742d8ff32457e1a11ad8286b9f97a21749fc3 /src
parenta9a12ef0b35b6e9aa220d5a55f95096277326730 (diff)
downloadhercules-15bb994898c212d3e02f404aa970a950d21a6554.tar.gz
hercules-15bb994898c212d3e02f404aa970a950d21a6554.tar.bz2
hercules-15bb994898c212d3e02f404aa970a950d21a6554.tar.xz
hercules-15bb994898c212d3e02f404aa970a950d21a6554.zip
Replace wrong variable usage in party creation code (closes #1185)
Also not allow create party with empty or only spaces name.
Diffstat (limited to 'src')
-rw-r--r--src/char/int_party.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/char/int_party.c b/src/char/int_party.c
index c011f1b8f..684d846d4 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -485,7 +485,7 @@ int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const
int i;
nullpo_ret(name);
nullpo_ret(leader);
- if( (p=inter_party->search_partyname(name))!=NULL){
+ if (!*name || (p = inter_party->search_partyname(name)) != NULL) {
mapif->party_created(fd,leader->account_id,leader->char_id,NULL);
return 0;
}
@@ -496,7 +496,8 @@ int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const
if (name[i] == '"') { /* client-special-char */
char *newname = aStrndup(name, NAME_LENGTH-1);
normalize_name(newname,"\"");
- mapif->parse_CreateParty(fd,name,item,item2,leader);
+ trim(newname);
+ mapif->parse_CreateParty(fd, newname, item, item2, leader);
aFree(newname);
return 0;
}
@@ -513,7 +514,7 @@ int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const
p = (struct party_data*)aCalloc(1, sizeof(struct party_data));
- memcpy(p->party.name,name,NAME_LENGTH);
+ safestrncpy(p->party.name, name, NAME_LENGTH);
p->party.exp=0;
p->party.item=(item?1:0)|(item2?2:0);