aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_festival.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-07-14 07:22:30 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-07-14 07:22:30 +0000
commit59d780973e0c1aab681be9dcba1baa2706caf92f (patch)
tree069cf4d5aa497e953fd1467abefc88134b3fc727 /apps/app_festival.c
parent8e06b188edfed3926b0e640a2294525b3488ccdf (diff)
Merge rgagnon's pedantic string checks (apps a-m, bug #2035)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3428 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_festival.c')
-rwxr-xr-xapps/app_festival.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 6e895b69a..c6a40089a 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -268,9 +268,9 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
int i;
struct MD5Context md5ctx;
unsigned char MD5Res[16];
- char MD5Hex[33];
- char koko[4];
- char cachefile[MAXFESTLEN];
+ char MD5Hex[33] = "";
+ char koko[4] = "";
+ char cachefile[MAXFESTLEN]="";
int readcache=0;
int writecache=0;
int strln;
@@ -348,18 +348,18 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
MD5Init(&md5ctx);
MD5Update(&md5ctx,(unsigned char const *)data,strlen(data));
MD5Final(MD5Res,&md5ctx);
- strcpy(MD5Hex,"");
+ MD5Hex[0] = '\0';
/* Convert to HEX and look if there is any matching file in the cache
directory */
for (i=0;i<16;i++) {
- sprintf(koko,"%X",MD5Res[i]);
- strcat(MD5Hex,koko);
+ snprintf(koko, sizeof(koko), "%X",MD5Res[i]);
+ strncat(MD5Hex, koko, sizeof(MD5Hex) - strlen(MD5Hex) - 1);
}
readcache=0;
writecache=0;
if (strlen(cachedir)+strlen(MD5Hex)+1<=MAXFESTLEN && (usecache==-1)) {
- sprintf(cachefile,"%s/%s",cachedir,MD5Hex);
+ snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);
fdesc=open(cachefile,O_RDWR);
if (fdesc==-1) {
fdesc=open(cachefile,O_CREAT|O_RDWR,0);