diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:22:30 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:22:30 +0000 |
commit | 59d780973e0c1aab681be9dcba1baa2706caf92f (patch) | |
tree | 069cf4d5aa497e953fd1467abefc88134b3fc727 /apps/app_agi.c | |
parent | 8e06b188edfed3926b0e640a2294525b3488ccdf (diff) |
Merge rgagnon's pedantic string checks (apps a-m, bug #2035)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3428 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_agi.c')
-rwxr-xr-x | apps/app_agi.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/app_agi.c b/apps/app_agi.c index 51f04e846..64790237c 100755 --- a/apps/app_agi.c +++ b/apps/app_agi.c @@ -1135,15 +1135,18 @@ static agi_command commands[] = { { { "set", "music", NULL }, handle_setmusic, "Enable/Disable Music on hold generator", usage_setmusic } }; -static void join(char *s, int len, char *w[]) +static void join(char *s, size_t len, char *w[]) { int x; /* Join words into a string */ - strcpy(s, ""); + if (!s) { + return; + } + s[0] = '\0'; for (x=0;w[x];x++) { if (x) - strncat(s, " ", len - strlen(s)); - strncat(s, w[x], len - strlen(s)); + strncat(s, " ", len - strlen(s) - 1); + strncat(s, w[x], len - strlen(s) - 1); } } |