summaryrefslogtreecommitdiff
path: root/apps/app_festival.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-07-14 07:22:30 +0000
committerMark Spencer <markster@digium.com>2004-07-14 07:22:30 +0000
commit4d32c4612623ecbff58f21286bc18d0000fe09aa (patch)
tree069cf4d5aa497e953fd1467abefc88134b3fc727 /apps/app_festival.c
parent4290558ec06ead3ac614d79635fa28452c76f316 (diff)
Merge rgagnon's pedantic string checks (apps a-m, bug #2035)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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);