aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-07 06:36:33 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-07 06:36:33 +0000
commit2d66183adf20c8b3898a3bfc97627d55dff7891f (patch)
treee1d83f46856427c7e9df46336f418ec059a92c57 /apps
parent6623be8860eb9337ebbc3a5a32388270fac5628b (diff)
Safely use the strncat() function.
(closes issue #11958) Reported by: norman Patches: 20080209__bug11958.diff.txt uploaded by Corydon76 (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@106552 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_chanspy.c2
-rw-r--r--apps/app_rpt.c6
-rw-r--r--apps/app_speech_utils.c2
-rw-r--r--apps/app_voicemail.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index a1e54ca44..eb093e09f 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -579,7 +579,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
}
strcpy(peer_name, "spy-");
- strncat(peer_name, peer->name, AST_NAME_STRLEN);
+ strncat(peer_name, peer->name, AST_NAME_STRLEN - 4 - 1);
ptr = strchr(peer_name, '/');
*ptr++ = '\0';
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index e7f7b003c..292dfc6f6 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -2427,7 +2427,7 @@ static int rpt_do_fun(int fd, int argc, char *argv[])
}
if(!busy){
myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,argv[3],MAXMACRO - 1);
+ strncat(myrpt->macrobuf, argv[3], MAXMACRO - strlen(myrpt->macrobuf) - 1);
}
rpt_mutex_unlock(&myrpt->lock);
}
@@ -5090,7 +5090,7 @@ int i;
return DC_ERROR;
}
myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,val,MAXMACRO - 1);
+ strncat(myrpt->macrobuf, val, MAXMACRO - strlen(myrpt->macrobuf) - 1);
rpt_mutex_unlock(&myrpt->lock);
return DC_COMPLETE;
}
@@ -8749,7 +8749,7 @@ static void do_scheduler(struct rpt *myrpt)
return; /* Macro buffer full */
}
myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,val,MAXMACRO - 1);
+ strncat(myrpt->macrobuf,val,MAXMACRO - strlen(myrpt->macrobuf) - 1);
}
else{
ast_log(LOG_WARNING,"Malformed scheduler entry in rpt.conf: %s = %s\n",
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index e45459166..64d0f1bc4 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -735,7 +735,7 @@ static int speech_background(struct ast_channel *chan, void *data)
}
time(&start);
snprintf(tmp, sizeof(tmp), "%c", f->subclass);
- strncat(dtmf, tmp, sizeof(dtmf));
+ strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
/* If the maximum length of the DTMF has been reached, stop now */
if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
done = 1;
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 74bfd2c9a..79e8bf2ea 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3842,8 +3842,8 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
make_file(msgfile, sizeof(msgfile), curdir, curmsg);
strcpy(textfile, msgfile);
strcpy(backup, msgfile);
- strncat(textfile, ".txt", sizeof(textfile) - 1);
- strncat(backup, "-bak", sizeof(backup) - 1);
+ strncat(textfile, ".txt", sizeof(textfile) - strlen(textfile) - 1);
+ strncat(backup, "-bak", sizeof(backup) - strlen(backup) - 1);
if (!(msg_cfg = ast_config_load(textfile))) {
return -1;