[Asterisk-cvs] asterisk/apps app_voicemail.c,1.55.2.4,1.55.2.5

markster at lists.digium.com markster at lists.digium.com
Mon Mar 8 00:12:22 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv3415/apps

Modified Files:
      Tag: v1-0_stable
	app_voicemail.c 
Log Message:
Fix strncpy auditing (bug #1152)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.55.2.4
retrieving revision 1.55.2.5
diff -u -d -r1.55.2.4 -r1.55.2.5
--- app_voicemail.c	28 Feb 2004 00:33:52 -0000	1.55.2.4
+++ app_voicemail.c	8 Mar 2004 05:04:27 -0000	1.55.2.5
@@ -2269,7 +2269,7 @@
 		system(sys);
 
 		todircount = count_messages(todir);
-		strncpy(tmp, fmt, sizeof(tmp));
+		strncpy(tmp, fmt, sizeof(tmp) - 1);
 		stringp = tmp;
 		while((s = strsep(&stringp, "|"))) {
 			/* XXX This is a hack -- we should use build_filename or similar XXX */
@@ -3019,22 +3019,22 @@
 	char *stringp;
 	char *s;
 	struct ast_vm_user *vmu;
-	strncpy(tmp, data, sizeof(tmp));
+	strncpy(tmp, data, sizeof(tmp) - 1);
 	vmu = malloc(sizeof(struct ast_vm_user));
 	if (vmu) {
 		memset(vmu, 0, sizeof(struct ast_vm_user));
-		strncpy(vmu->context, context, sizeof(vmu->context));
-		strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox));
+		strncpy(vmu->context, context, sizeof(vmu->context) - 1);
+		strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox) - 1);
 		vmu->attach = -1;
 		stringp = tmp;
 		if ((s = strsep(&stringp, ","))) 
-			strncpy(vmu->password, s, sizeof(vmu->password));
+			strncpy(vmu->password, s, sizeof(vmu->password) - 1);
 		if (stringp && (s = strsep(&stringp, ","))) 
-			strncpy(vmu->fullname, s, sizeof(vmu->fullname));
+			strncpy(vmu->fullname, s, sizeof(vmu->fullname) - 1);
 		if (stringp && (s = strsep(&stringp, ","))) 
-			strncpy(vmu->email, s, sizeof(vmu->email));
+			strncpy(vmu->email, s, sizeof(vmu->email) - 1);
 		if (stringp && (s = strsep(&stringp, ","))) 
-			strncpy(vmu->pager, s, sizeof(vmu->pager));
+			strncpy(vmu->pager, s, sizeof(vmu->pager) - 1);
 		if (stringp && (s = strsep(&stringp, ","))) 
 			apply_options(vmu, s);
 		vmu->next = NULL;




More information about the svn-commits mailing list