Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 129732) +++ apps/app_meetme.c (working copy) @@ -954,7 +954,7 @@ int hr, min, sec; int i = 0, total = 0; time_t now; - char cmdline[1024] = ""; + struct ast_str *cmdline; #define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n" #define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n" @@ -991,14 +991,14 @@ ast_cli(a->fd, MC_HEADER_FORMAT, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked"); AST_LIST_TRAVERSE(&confs, cnf, list) { if (cnf->markedusers == 0) - strcpy(cmdline, "N/A "); + ast_copy_string(cmdline->str, "N/A ", sizeof(cmdline)); else - snprintf(cmdline, sizeof(cmdline), "%4.4d", cnf->markedusers); + ast_str_set(&cmdline, 0, "%4.4d", cnf->markedusers); hr = (now - cnf->start) / 3600; min = ((now - cnf->start) % 3600) / 60; sec = (now - cnf->start) % 60; if (!concise) - ast_cli(a->fd, MC_DATA_FORMAT, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No"); + ast_cli(a->fd, MC_DATA_FORMAT, cnf->confno, cnf->users, cmdline->str, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No"); else { ast_cli(a->fd, "%s!%d!%d!%02d:%02d:%02d!%d!%d\n", cnf->confno, @@ -1018,14 +1018,14 @@ } if (a->argc < 3) return CLI_SHOWUSAGE; - ast_copy_string(cmdline, a->argv[2], sizeof(cmdline)); /* Argv 2: conference number */ + ast_copy_string(cmdline->str, a->argv[2], sizeof(cmdline->str)); /* Argv 2: conference number */ if (strstr(a->argv[1], "lock")) { if (strcmp(a->argv[1], "lock") == 0) { /* Lock */ - strncat(cmdline, ",L", sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",L"); } else { /* Unlock */ - strncat(cmdline, ",l", sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",l"); } } else if (strstr(a->argv[1], "mute")) { if (a->argc < 4) @@ -1033,18 +1033,16 @@ if (strcmp(a->argv[1], "mute") == 0) { /* Mute */ if (strcmp(a->argv[3], "all") == 0) { - strncat(cmdline, ",N", sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",N"); } else { - strncat(cmdline, ",M,", sizeof(cmdline) - strlen(cmdline) - 1); - strncat(cmdline, a->argv[3], sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",M,%s", a->argv[3]); } } else { /* Unmute */ if (strcmp(a->argv[3], "all") == 0) { - strncat(cmdline, ",n", sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",n"); } else { - strncat(cmdline, ",m,", sizeof(cmdline) - strlen(cmdline) - 1); - strncat(cmdline, a->argv[3], sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",m,%s", a->argv[3]); } } } else if (strcmp(a->argv[1], "kick") == 0) { @@ -1052,11 +1050,10 @@ return CLI_SHOWUSAGE; if (strcmp(a->argv[3], "all") == 0) { /* Kick all */ - strncat(cmdline, ",K", sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",K"); } else { /* Kick a single user */ - strncat(cmdline, ",k,", sizeof(cmdline) - strlen(cmdline) - 1); - strncat(cmdline, a->argv[3], sizeof(cmdline) - strlen(cmdline) - 1); + ast_str_append(&cmdline, 0, ",k,%s", a->argv[3]); } } else if (strcmp(a->argv[1], "list") == 0) { int concise = (a->argc == 4 && (!strcasecmp(a->argv[3], "concise"))); @@ -1115,10 +1112,12 @@ } else return CLI_SHOWUSAGE; - ast_debug(1, "Cmdline: %s\n", cmdline); + ast_debug(1, "Cmdline: %s\n", cmdline->str); - admin_exec(NULL, cmdline); + admin_exec(NULL, cmdline->str); + ast_free(cmdline); + return CLI_SUCCESS; } @@ -3912,7 +3911,7 @@ { struct sla_station *station; struct sla_trunk_ref *trunk_ref; - char conf_name[MAX_CONFNUM]; + struct ast_str *conf_name; struct ast_flags conf_flags = { 0 }; struct ast_conference *conf; @@ -3927,11 +3926,11 @@ } ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, 1); - snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name); + ast_str_set(&conf_name, 0, "SLA_%s", trunk_ref->trunk->name); ast_set_flag(&conf_flags, CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION); ast_answer(trunk_ref->chan); - conf = build_conf(conf_name, "", "", 0, 0, 1, trunk_ref->chan); + conf = build_conf(conf_name->str, "", "", 0, 0, 1, trunk_ref->chan); if (conf) { conf_run(trunk_ref->chan, conf, conf_flags.flags, NULL); dispose_conf(conf); @@ -3940,12 +3939,12 @@ trunk_ref->chan = NULL; if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) && trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) { - strncat(conf_name, ",K", sizeof(conf_name) - strlen(conf_name) - 1); - admin_exec(NULL, conf_name); + ast_str_append(&conf_name, 0, ",K"); + admin_exec(NULL, conf_name->str); trunk_ref->trunk->hold_stations = 0; sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); } - + ast_free(conf_name); ast_dial_join(station->dial); ast_dial_destroy(station->dial); station->dial = NULL;