Last set of strncpy/snprintf updates (bug #2049)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3446 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-07-16 04:40:54 +00:00
parent 78117423fa
commit bba1faf910
17 changed files with 320 additions and 279 deletions

View File

@@ -825,7 +825,7 @@ static char sendtext_usage[] =
static int console_sendtext(int fd, int argc, char *argv[])
{
int tmparg = 2;
char text2send[256];
char text2send[256] = "";
struct ast_frame f = { 0, };
if (argc < 2)
return RESULT_SHOWUSAGE;
@@ -835,10 +835,10 @@ static int console_sendtext(int fd, int argc, char *argv[])
}
if (strlen(text2send))
ast_cli(fd, "Warning: message already waiting to be sent, overwriting\n");
strcpy(text2send, "");
text2send[0] = '\0';
while(tmparg < argc) {
strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send));
strncat(text2send, " ", sizeof(text2send) - strlen(text2send));
strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
}
if (strlen(text2send)) {
f.frametype = AST_FRAME_TEXT;