[svn-commits] jpeeler: branch 1.4 r306864 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 8 10:19:21 CST 2011


Author: jpeeler
Date: Tue Feb  8 10:19:17 2011
New Revision: 306864

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306864
Log:
make this safer and fully correct, pointed out by Steve Davis

Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=306864&r1=306863&r2=306864
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Tue Feb  8 10:19:17 2011
@@ -2925,7 +2925,7 @@
 	DIR *msgdir;
 	struct dirent *msgdirent;
 	int msgdirint;
-	char extension[3];
+	char extension[4];
 	int stopcount = 0;
 
 	/* Reading the entire directory into a file map scales better than
@@ -2937,7 +2937,7 @@
 	}
 
 	while ((msgdirent = readdir(msgdir))) {
-		if (sscanf(msgdirent->d_name, "msg%30d.%3s", &msgdirint, extension) == 2 && msgdirint < MAXMSGLIMIT && !strcmp(extension, "txt")) {
+		if (!strcmp(extension, "txt") && msgdirint < MAXMSGLIMIT && sscanf(msgdirent->d_name, "msg%10d.%3s", &msgdirint, extension) == 2) {
 			map[msgdirint] = 1;
 			stopcount++;
 			if (option_debug > 3) {




More information about the svn-commits mailing list