diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-18 15:58:50 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-18 15:58:50 +0000 |
commit | 48d2267d2d05bf4acaa2ae4e00e3d9b600cce235 (patch) | |
tree | b91e3d85242f15336883bd197abbe86cd66fdfc8 /apps/app_festival.c | |
parent | 99e420ecd8ad845f253266482101298583994c00 (diff) |
Merged revisions 109447 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r109447 | twilson | 2008-03-18 10:43:34 -0500 (Tue, 18 Mar 2008) | 3 lines
Go through and fix a bunch of places where character strings were being interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not
actual problems, per se. I also added format attributes to any printf wrapper functions I found that didn't have them. -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@109459 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_festival.c')
-rw-r--r-- | apps/app_festival.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c index 926638e57..e788291ed 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -327,11 +327,21 @@ static int festival_exec(struct ast_channel *chan, void *vdata) if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) { cachedir = "/tmp/"; } + + data = ast_strdupa(vdata); + AST_STANDARD_APP_ARGS(args, data); + if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) { - festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n"; + const char *startcmd = "(tts_textasterisk \""; + const char *endcmd = "\" 'file)(quit)\n"; + + strln = strlen(startcmd) + strlen(args.text) + strlen(endcmd) + 1; + newfestivalcommand = alloca(strln); + snprintf(newfestivalcommand, strln, "%s%s%s", startcmd, args.text, endcmd); + festivalcommand = newfestivalcommand; } else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */ int i, j; - newfestivalcommand = alloca(strlen(festivalcommand) + 1); + newfestivalcommand = alloca(strlen(festivalcommand) + strlen(args.text) + 1); for (i = 0, j = 0; i < strlen(festivalcommand); i++) { if (festivalcommand[i] == '\\' && festivalcommand[i + 1] == 'n') { @@ -340,6 +350,10 @@ static int festival_exec(struct ast_channel *chan, void *vdata) } else if (festivalcommand[i] == '\\') { newfestivalcommand[j++] = festivalcommand[i + 1]; i++; + } else if (festivalcommand[i] == '%' && festivalcommand[i + 1] == 's') { + sprintf(&newfestivalcommand[j], "%s", args.text); /* we know it is big enough */ + j += strlen(args.text); + i++; } else newfestivalcommand[j++] = festivalcommand[i]; } @@ -347,9 +361,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) festivalcommand = newfestivalcommand; } - data = ast_strdupa(vdata); - AST_STANDARD_APP_ARGS(args, data); - if (args.interrupt && !strcasecmp(args.interrupt, "any")) args.interrupt = AST_DIGIT_ANY; @@ -440,7 +451,8 @@ static int festival_exec(struct ast_channel *chan, void *vdata) } else { ast_debug(1, "Passing text to festival...\n"); fs = fdopen(dup(fd), "wb"); - fprintf(fs, festivalcommand, args.text); + + fprintf(fs, "%s", festivalcommand); fflush(fs); fclose(fs); } |