mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-21 20:40:10 +00:00
- move the string join() function to utils.c since it is used in both cli.c and res_agi.c
- reimplement ast_join to be of linear effieciency instead of quadratic - remove some useless checks for "if (e)" - reorder checks for strings starting with '_' to avoid a useless call to ast_join() - check array bounds when parsing arguments to AGI (issue #5868) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
cli.c
13
cli.c
@@ -1019,17 +1019,8 @@ static struct ast_cli_entry *find_cli(char *cmds[], int exact)
|
||||
|
||||
static void join(char *dest, size_t destsize, char *w[], int tws)
|
||||
{
|
||||
int x;
|
||||
/* Join words into a string */
|
||||
if (!dest || destsize < 1) {
|
||||
return;
|
||||
}
|
||||
dest[0] = '\0';
|
||||
for (x=0;w[x];x++) {
|
||||
if (x)
|
||||
strncat(dest, " ", destsize - strlen(dest) - 1);
|
||||
strncat(dest, w[x], destsize - strlen(dest) - 1);
|
||||
}
|
||||
ast_join(dest, destsize, w);
|
||||
|
||||
if (tws && !ast_strlen_zero(dest))
|
||||
strncat(dest, " ", destsize - strlen(dest) - 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user