summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/guild.c9
-rw-r--r--src/map/party.c8
2 files changed, 7 insertions, 10 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 0eae68b57..aa91ee3ac 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -400,13 +400,14 @@ int guild_send_dot_remove(struct map_session_data *sd)
// 作成要求
int guild_create(struct map_session_data *sd,char *name)
{
- char *tname = aStrdup(name);
+ char tname[NAME_LENGTH];
nullpo_retr(0, sd);
- if(sd->status.guild_id || strlen(trim(tname)) < 2)
+ safestrncpy(tname, name, NAME_LENGTH);
+
+ if(sd->status.guild_id || strlen(trim(tname)) == 0)
{
clif_guild_created(sd,1); // すでに所属している
- aFree(tname);
return 0;
}
if(!battle_config.guild_emperium_check || pc_search_inventory(sd,714) >= 0) {
@@ -414,11 +415,9 @@ int guild_create(struct map_session_data *sd,char *name)
guild_makemember(&m,sd);
m.position=0;
intif_guild_create(name,&m);
- aFree(tname);
return 1;
}
clif_guild_created(sd,3); // エンペリウムがいない
- aFree(tname);
return 0;
}
diff --git a/src/map/party.c b/src/map/party.c
index f165fe881..a008d07eb 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -109,18 +109,17 @@ struct party_data* party_searchname(const char* str)
int party_create(struct map_session_data *sd,char *name,int item,int item2)
{
struct party_member leader;
- char * tname = aStrdup(name);
+ char tname[NAME_LENGTH];
+ safestrncpy(tname, name, NAME_LENGTH);
if(sd->status.party_id) {
clif_party_created(sd,2);
- aFree(tname);
return 0; // "already in a party"
}
- if(strlen(trim(tname)) < 2)
+ if(strlen(trim(tname)) == 0)
{
clif_party_created(sd, 1);
- aFree(tname);
return 0;
}
@@ -131,7 +130,6 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
leader.leader = 1;
intif_create_party(&leader,name,item,item2);
- aFree(tname);
return 0;
}