diff --git a/source/banlist.c b/source/banlist.c index 04ca517..ecdfc0f 100644 --- a/source/banlist.c +++ b/source/banlist.c @@ -1198,8 +1198,7 @@ BUILT_IN_COMMAND(kickban) if (rest && !*rest) rest = NULL; } - tspec = alloca(strlen(spec)+1); - strcpy(tspec, spec); + tspec = LOCAL_COPY(spec); while ((tnick = next_in_comma_list(tspec, &tspec))) { int exact = 1; diff --git a/source/cdcc.c b/source/cdcc.c index 9608502..5544eaf 100644 --- a/source/cdcc.c +++ b/source/cdcc.c @@ -1259,8 +1259,7 @@ static void add_files(char *args, char *rest) struct dirent *dir; struct stat statbuf; - path = alloca(strlen(rest)+1); - strcpy(path, rest); + path = LOCAL_COPY(rest); temp = alloca(BIG_BUFFER_SIZE + 1); *temp = 0; diff --git a/source/commands2.c b/source/commands2.c index 97933c8..e2e311e 100644 --- a/source/commands2.c +++ b/source/commands2.c @@ -1049,8 +1049,7 @@ int server = -1; char *buffer = NULL; char *save_buffer = NULL; int num = 0, count = 0; - m_buff = alloca(strlen(match)+1); - strcpy(m_buff, match); + m_buff = LOCAL_COPY(match); bitchsay("Killing all matching %s.", pattern); while ((nick = next_in_comma_list(m_buff, &m_buff))) { diff --git a/source/cset.c b/source/cset.c index 1ba5849..bb9a7f2 100644 --- a/source/cset.c +++ b/source/cset.c @@ -230,8 +230,7 @@ static int find_cset_variable(CSetArray *array, char *org_name, int *cnt) char *name = NULL; len = strlen(org_name); - name = alloca(len + 1); - strcpy(name, org_name); + name = LOCAL_COPY(org_name); upper(name); var_index = 0; @@ -708,8 +707,7 @@ static int find_wset_variable(WSetArray *array, char *org_name, int *cnt) char *name = NULL; len = strlen(org_name); - name = alloca(len + 1); - strcpy(name, org_name); + name = LOCAL_COPY(org_name); upper(name); var_index = 0; diff --git a/source/debug.c b/source/debug.c index ae12537..cceb6a0 100644 --- a/source/debug.c +++ b/source/debug.c @@ -152,8 +152,7 @@ int parse_debug(char *value, int nvalue, char **rv) if (!value) return 0; - copy = alloca(strlen(value) + 1); - strcpy(copy, value); + copy = LOCAL_COPY(value); while ((str1 = new_next_arg(copy, ©))) { diff --git a/source/flood.c b/source/flood.c index 0a4e5f2..a7cc20c 100644 --- a/source/flood.c +++ b/source/flood.c @@ -467,8 +467,7 @@ ChannelList *chan = NULL; if (!nick_isop(Nick) || get_cset_int_var(chan->csets, KICK_OPS_CSET)) { char *ban, *u, *h; - u = alloca(strlen(Nick->host)+1); - strcpy(u, Nick->host); + u = LOCAL_COPY(Nick->host); h = strchr(u, '@'); *h++ = 0; ban = ban_it(Nick->nick, u, h, Nick->ip); diff --git a/source/fset.c b/source/fset.c index af31ce2..f3d810e 100644 --- a/source/fset.c +++ b/source/fset.c @@ -895,8 +895,7 @@ IrcVariable *fget_var_address(char *var_name) IrcVariable *var = NULL; int cnt, msv_index; - char *tmp_var = alloca(strlen(var_name)+1); - strcpy(tmp_var, var_name); + char *tmp_var = LOCAL_COPY(var_name); upper(tmp_var); if ((var = find_ext_fset_var(tmp_var))) return var; diff --git a/source/input.c b/source/input.c index 036d51a..71f23b2 100644 --- a/source/input.c +++ b/source/input.c @@ -798,8 +798,7 @@ BUILT_IN_KEYBINDING(input_add_character) { char *ptr = NULL; - ptr = alloca(strlen(&(THIS_CHAR)) + 1); - strcpy(ptr, &(THIS_CHAR)); + ptr = LOCAL_COPY(&(THIS_CHAR)); THIS_CHAR = key; NEXT_CHAR = 0; ADD_TO_INPUT(ptr); diff --git a/source/numbers.c b/source/numbers.c index 5efe62f..c1ccad1 100644 --- a/source/numbers.c +++ b/source/numbers.c @@ -723,16 +723,14 @@ void numbered_command(char *from, int comm, char **ArgList) */ if ((p = (char *)strchr(ArgList[2], '@'))) { *p++ = '\0'; - ident = (char *)alloca(strlen(ArgList[2])+1); - strcpy(ident, ArgList[2]); + ident = LOCAL_COPY(ArgList[2]); for(;*p == ' ';) p++; host = p; if ((p = (char *)strchr(p, '\n'))) *p = '\0'; p = host; - host = (char *)alloca(strlen(p)+1); - strcpy(host, p); + host = LOCAL_COPY(p); } put_it("%s", convert_output_format(fget_string_var(FORMAT_WHOIS_HEADER_FSET), NULL)); diff --git a/source/parse.c b/source/parse.c index 0516ce6..7d07cb6 100644 --- a/source/parse.c +++ b/source/parse.c @@ -138,8 +138,7 @@ char *p = NULL; char *pat; if (!str || !*str || !get_int_var(AUTO_RESPONSE_VAR)) return 0; - p = alloca(strlen(auto_str)+1); - strcpy(p, auto_str); + p = LOCAL_COPY(auto_str); if (p && *p) { while ((pat = next_arg(p, &p))) @@ -1090,8 +1089,7 @@ static void p_channel(char *from, char **ArgList) #ifdef WANT_NSLOOKUP char *host; #endif - user = alloca(strlen(FromUserHost)+1); - strcpy(user, FromUserHost); + user = LOCAL_COPY(FromUserHost); #ifdef WANT_NSLOOKUP if ((host = strchr(user, '@'))) diff --git a/source/scr-bx.c b/source/scr-bx.c index 85daa10..b102d4a 100644 --- a/source/scr-bx.c +++ b/source/scr-bx.c @@ -196,8 +196,7 @@ char *new_path, *p; int count = 0; int doit = 0; - new_path = alloca(strlen(path)+1); - strcpy(new_path, path); + new_path = LOCAL_COPY(path); if ((p = strrchr(new_path, '/'))) *p = 0; if (!(dptr = opendir(new_path))) @@ -247,8 +246,7 @@ struct dirent *dir; struct stat st; char *ret = NULL, *p; int count = 0; - new_path = alloca(strlen(path)+1); - strcpy(new_path, path); + new_path = LOCAL_COPY(path); if ((p = strrchr(new_path, '/'))) *p = 0; else @@ -274,8 +272,7 @@ int count = 0; if (name) { char *pid, *n_tty, *h_name; - pid = alloca(strlen(p)+1); - strcpy(pid, p); + pid = LOCAL_COPY(p); n_tty = strchr(pid, '.'); *n_tty++ = 0; h_name = strchr(n_tty, '.'); *h_name++ = 0; if (strcmp(name, pid)) diff --git a/source/user.c b/source/user.c index 98e1a43..0371daf 100644 --- a/source/user.c +++ b/source/user.c @@ -83,8 +83,7 @@ long hvalue; if (!strchr(uptr->channels, '*')) { char *channel, *ptr; - channel = alloca(strlen(uptr->channels)+1); - strcpy(channel, uptr->channels); + channel = LOCAL_COPY(uptr->channels); while ((ptr = next_in_comma_list(channel, &channel))) { if (!*ptr) diff --git a/source/userlist.c b/source/userlist.c index b535195..07307c4 100644 --- a/source/userlist.c +++ b/source/userlist.c @@ -1186,8 +1186,7 @@ char *ban; ban = m_3dup(nicklist->nick, "!", nicklist->host); if (nicklist->ip && nicklist->host) { - char *user = alloca(strlen(nicklist->host)+1); - strcpy(user, nicklist->host); + char *user = LOCAL_COPY(nicklist->host); if ((u = strchr(user, '@'))) *u = 0; ipban = m_opendup(nicklist->nick, "!", user, "@", nicklist->ip, NULL); @@ -1448,8 +1447,7 @@ int check_channel_match(char *tmp, char *channel) return 0; if (*channel == '*' && (strlen(channel)==1)) return 1; - q = chan = alloca(strlen(tmp)+1); - strcpy(chan, tmp); + q = chan = LOCAL_COPY(tmp); while ((p = next_in_comma_list(chan, &chan))) {