Index: channels/chan_agent.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v retrieving revision 1.162 diff -u -r1.162 chan_agent.c --- channels/chan_agent.c 27 Oct 2005 02:19:37 -0000 1.162 +++ channels/chan_agent.c 26 Oct 2005 23:52:06 -0000 @@ -1033,12 +1033,12 @@ p->dead = 1; p = p->next; } - strcpy(moh, "default"); + ast_copy_string(moh, "default", sizeof(moh)); /* set the default recording values */ recordagentcalls = 0; createlink = 0; - strcpy(recordformat, "wav"); - strcpy(recordformatext, "wav"); + ast_copy_string(recordformat, "wav", sizeof(recordformat)); + ast_copy_string(recordformatext, "wav", sizeof(recordformatext)); urlprefix[0] = '\0'; savecallsin[0] = '\0'; @@ -1074,7 +1074,7 @@ if (maxlogintries < 0) maxlogintries = 0; } else if (!strcasecmp(v->name, "goodbye") && !ast_strlen_zero(v->value)) { - strcpy(agentgoodbye,v->value); + ast_copy_string(agentgoodbye,v->value, sizeof(agentgoodbye)); } else if (!strcasecmp(v->name, "musiconhold")) { ast_copy_string(moh, v->value, sizeof(moh)); } else if (!strcasecmp(v->name, "updatecdr")) { @@ -1089,7 +1089,7 @@ } else if (!strcasecmp(v->name, "recordformat")) { ast_copy_string(recordformat, v->value, sizeof(recordformat)); if (!strcasecmp(v->value, "wav49")) - strcpy(recordformatext, "WAV"); + ast_copy_string(recordformatext, "WAV", sizeof(recordformatext)); else ast_copy_string(recordformatext, v->value, sizeof(recordformatext)); } else if (!strcasecmp(v->name, "urlprefix")) { @@ -1600,7 +1600,7 @@ if (p->owner && ast_bridged_channel(p->owner)) { snprintf(talkingto, sizeof(talkingto), " talking to %s", ast_bridged_channel(p->owner)->name); } else { - strcpy(talkingto, " is idle"); + ast_copy_string(talkingto, " is idle", sizeof(talkingto)); } online_agents++; } else if (!ast_strlen_zero(p->loginchan)) { @@ -1610,7 +1610,7 @@ if (p->acknowledged) strncat(location, " (Confirmed)", sizeof(location) - strlen(location) - 1); } else { - strcpy(location, "not logged in"); + ast_copy_string(location, "not logged in", sizeof(location)); talkingto[0] = '\0'; offline_agents++; } @@ -1716,7 +1716,7 @@ ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,chan->name); } if (pbx_builtin_getvar_helper(chan, "AGENTGOODBYE") && !ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"))) { - strcpy(agent_goodbye, pbx_builtin_getvar_helper(chan, "AGENTGOODBYE")); + ast_copy_string(agent_goodbye, pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"), sizeof(agent_goodbye)); tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"); if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name); Index: channels/chan_iax2.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v retrieving revision 1.364 diff -u -r1.364 chan_iax2.c --- channels/chan_iax2.c 27 Oct 2005 02:19:37 -0000 1.364 +++ channels/chan_iax2.c 26 Oct 2005 23:52:09 -0000 @@ -6771,8 +6771,8 @@ } format = iaxs[fr.callno]->peerformat & iaxs[fr.callno]->capability; memset(&pref, 0, sizeof(pref)); - strcpy(caller_pref_buf, "disabled"); - strcpy(host_pref_buf, "disabled"); + ast_copy_string(caller_pref_buf, "disabled",sizeof(caller_pref_buf)); + ast_copy_string(host_pref_buf, "disabled",sizeof(host_pref_buf)); } else { using_prefs = "mine"; if(ies.codec_prefs) { @@ -6815,8 +6815,8 @@ using_prefs = ast_test_flag(iaxs[fr.callno], IAX_CODEC_NOCAP) ? "reqonly" : "disabled"; memset(&pref, 0, sizeof(pref)); format = ast_best_codec(iaxs[fr.callno]->peercapability & iaxs[fr.callno]->capability); - strcpy(caller_pref_buf,"disabled"); - strcpy(host_pref_buf,"disabled"); + ast_copy_string(caller_pref_buf,"disabled",sizeof(caller_pref_buf)); + ast_copy_string(host_pref_buf,"disabled",sizeof(host_pref_buf)); } else { using_prefs = "mine"; if(ies.codec_prefs) { @@ -7176,8 +7176,8 @@ } format = iaxs[fr.callno]->peerformat & iaxs[fr.callno]->capability; memset(&pref, 0, sizeof(pref)); - strcpy(caller_pref_buf, "disabled"); - strcpy(host_pref_buf, "disabled"); + ast_copy_string(caller_pref_buf, "disabled", sizeof(caller_pref_buf)); + ast_copy_string(host_pref_buf, "disabled", sizeof(host_pref_buf)); } else { using_prefs = "mine"; if(ies.codec_prefs) { @@ -7223,8 +7223,8 @@ memset(&pref, 0, sizeof(pref)); format = ast_test_flag(iaxs[fr.callno], IAX_CODEC_NOCAP) ? iaxs[fr.callno]->peerformat : ast_best_codec(iaxs[fr.callno]->peercapability & iaxs[fr.callno]->capability); - strcpy(caller_pref_buf,"disabled"); - strcpy(host_pref_buf,"disabled"); + ast_copy_string(caller_pref_buf,"disabled",sizeof(caller_pref_buf)); + ast_copy_string(host_pref_buf,"disabled",sizeof(host_pref_buf)); } else { using_prefs = "mine"; if(ies.codec_prefs) { Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.898 diff -u -r1.898 chan_sip.c --- channels/chan_sip.c 27 Oct 2005 02:19:37 -0000 1.898 +++ channels/chan_sip.c 26 Oct 2005 23:52:14 -0000 @@ -3065,11 +3065,11 @@ ast_copy_string(p->callid, callid, sizeof(p->callid)); ast_copy_flags(p, &global_flags, SIP_FLAGS_TO_COPY); /* Assign default music on hold class */ - strcpy(p->musicclass, global_musicclass); + ast_copy_string(p->musicclass, global_musicclass, sizeof(p->musicclass)); p->capability = global_capability; if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_RFC2833) || (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_AUTO)) p->noncodeccapability |= AST_RTP_DTMF; - strcpy(p->context, default_context); + ast_copy_string(p->context, default_context, sizeof(p->context)); /* Add to active dialog list */ ast_mutex_lock(&iflock); @@ -4711,7 +4711,7 @@ /* If we have only digits, add ;user=phone to the uri */ if (onlydigits) - strcpy(urioptions, ";user=phone"); + ast_copy_string(urioptions, ";user=phone", sizeof(urioptions)); } @@ -5149,7 +5149,7 @@ add_header(&req, "Subscription-state", "terminated;reason=noresource"); add_header(&req, "Content-Type", "message/sipfrag;version=2.0"); - strcpy(tmp, "SIP/2.0 200 OK"); + ast_copy_string(tmp, "SIP/2.0 200 OK", sizeof(tmp)); add_header_contentLength(&req, strlen(tmp)); add_line(&req, tmp); @@ -10152,7 +10152,7 @@ build_contact(p); /* XXX Should we authenticate OPTIONS? XXX */ if (ast_strlen_zero(p->context)) - strcpy(p->context, default_context); + ast_copy_string(p->context, default_context, sizeof(p->context)); if (res < 0) transmit_response_with_allow(p, "404 Not Found", req, 0); else if (res > 0) @@ -10266,7 +10266,7 @@ ast_queue_frame(p->owner, &af); /* Initialize the context if it hasn't been already */ if (ast_strlen_zero(p->context)) - strcpy(p->context, default_context); + ast_copy_string(p->context, default_context, sizeof(p->context)); /* Check number of concurrent calls -vs- incoming limit HERE */ ast_log(LOG_DEBUG, "Checking SIP call limits for device %s\n", p->username); res = update_call_counter(p, INC_CALL_LIMIT); @@ -10436,7 +10436,7 @@ if (option_debug > 2) ast_log(LOG_DEBUG, "SIP call transfer received for call %s (REFER)!\n", p->callid); if (ast_strlen_zero(p->context)) - strcpy(p->context, default_context); + ast_copy_string(p->context, default_context, sizeof(p->context)); res = get_refer_info(p, req); if (res < 0) transmit_response_with_allow(p, "404 Not Found", req, 1); @@ -10548,7 +10548,7 @@ ast_log(LOG_NOTICE, "Client '%s' using deprecated BYE/Also transfer method. Ask vendor to support REFER instead\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr)); if (ast_strlen_zero(p->context)) - strcpy(p->context, default_context); + ast_copy_string(p->context, default_context, sizeof(p->context)); res = get_also_info(p, req); if (!res) { c = p->owner; @@ -10644,7 +10644,7 @@ if (!ast_strlen_zero(p->subscribecontext)) ast_copy_string(p->context, p->subscribecontext, sizeof(p->context)); else if (ast_strlen_zero(p->context)) - strcpy(p->context, default_context); + ast_copy_string(p->context, default_context, sizeof(p->context)); /* Get destination right away */ gotdest = get_destination(p, NULL); build_contact(p); @@ -11774,9 +11774,9 @@ user->capability = global_capability; user->prefs = prefs; /* set default context */ - strcpy(user->context, default_context); - strcpy(user->language, default_language); - strcpy(user->musicclass, global_musicclass); + ast_copy_string(user->context, default_context, sizeof(user->context)); + ast_copy_string(user->language, default_language, sizeof(user->language)); + ast_copy_string(user->musicclass, global_musicclass, sizeof(user->musicclass)); while(v) { if (handle_common_options(&userflags, &mask, v)) { v = v->next; @@ -11863,10 +11863,10 @@ peer->pokeexpire = -1; ast_copy_string(peer->name, name, sizeof(peer->name)); ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY); - strcpy(peer->context, default_context); - strcpy(peer->subscribecontext, default_subscribecontext); - strcpy(peer->language, default_language); - strcpy(peer->musicclass, global_musicclass); + ast_copy_string(peer->context, default_context, sizeof(peer->context)); + ast_copy_string(peer->subscribecontext, default_subscribecontext, sizeof(peer->subscribecontext)); + ast_copy_string(peer->language, default_language, sizeof(peer->language)); + ast_copy_string(peer->musicclass, global_musicclass, sizeof(peer->musicclass)); peer->addr.sin_port = htons(DEFAULT_SIP_PORT); peer->addr.sin_family = AF_INET; peer->capability = global_capability; @@ -11935,11 +11935,11 @@ ast_variables_destroy(peer->chanvars); peer->chanvars = NULL; } - strcpy(peer->context, default_context); - strcpy(peer->subscribecontext, default_subscribecontext); - strcpy(peer->vmexten, global_vmexten); - strcpy(peer->language, default_language); - strcpy(peer->musicclass, global_musicclass); + ast_copy_string(peer->context, default_context, sizeof(peer->context)); + ast_copy_string(peer->subscribecontext, default_subscribecontext, sizeof(peer->subscribecontext)); + ast_copy_string(peer->vmexten, global_vmexten, sizeof(peer->vmexten)); + ast_copy_string(peer->language, default_language, sizeof(peer->language)); + ast_copy_string(peer->musicclass, global_musicclass, sizeof(peer->musicclass)); ast_copy_flags(peer, &global_flags, SIP_USEREQPHONE); peer->secret[0] = '\0'; peer->md5secret[0] = '\0'; @@ -12210,7 +12210,7 @@ ast_set_flag(&global_flags, SIP_CAN_REINVITE); ast_set_flag(&global_flags_page2, SIP_PAGE2_RTUPDATE); global_mwitime = DEFAULT_MWITIME; - strcpy(global_vmexten, DEFAULT_VMEXTEN); + ast_copy_string(global_vmexten, DEFAULT_VMEXTEN, sizeof(global_vmexten)); srvlookup = 0; autocreatepeer = 0; regcontext[0] = '\0'; Index: channels/chan_zap.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v retrieving revision 1.536 diff -u -r1.536 chan_zap.c --- channels/chan_zap.c 27 Oct 2005 02:19:37 -0000 1.536 +++ channels/chan_zap.c 26 Oct 2005 23:52:18 -0000 @@ -9713,9 +9713,9 @@ } } else { if (s.numchans) - strcpy(alarms, "OK"); + ast_copy_string(alarms, "OK", sizeof(alarms)); else - strcpy(alarms, "UNCONFIGURED"); + ast_copy_string(alarms, "UNCONFIGURED", sizeof(alarms)); } ast_cli(fd, FORMAT, s.desc, alarms, s.irqmisses, s.bpvcount, s.crc4count); Index: channels/iax2-parser.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v retrieving revision 1.55 diff -u -r1.55 iax2-parser.c --- channels/iax2-parser.c 27 Oct 2005 02:42:05 -0000 1.55 +++ channels/iax2-parser.c 26 Oct 2005 23:52:18 -0000 @@ -294,7 +294,7 @@ char tmp[256]; if (len < 2) return; - strcpy(output, "\n"); + ast_copy_string(output, "\n", sizeof(output)); maxlen -= strlen(output); output += strlen(output); while(len > 2) { ie = iedata[0]; @@ -318,7 +318,7 @@ if (ielen) snprintf(interp, (int)sizeof(interp), "%d bytes", ielen); else - strcpy(interp, "Present"); + ast_copy_string(interp, "Present", sizeof(interp)); snprintf(tmp, (int)sizeof(tmp), " %-15.15s : %s\n", prov_ies[x].name, interp); ast_copy_string(output, tmp, maxlen); maxlen -= strlen(output); output += strlen(output); @@ -365,7 +365,7 @@ if (ielen) snprintf(interp, (int)sizeof(interp), "%d bytes", ielen); else - strcpy(interp, "Present"); + ast_copy_string(interp, "Present", sizeof(interp)); snprintf(tmp, (int)sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp); outputf(tmp); } @@ -475,9 +475,9 @@ } else { fh = fhi; if (ntohs(fh->dcallno) & IAX_FLAG_RETRANS) - strcpy(retries, "Yes"); + ast_copy_string(retries, "Yes", sizeof(retries)); else - strcpy(retries, " No"); + ast_copy_string(retries, " No", sizeof(retries)); } if (!(ntohs(fh->scallno) & IAX_FLAG_FULL)) { /* Don't mess with mini-frames */