[Freeswitch-svn] [commit] r8476 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Mon May 19 17:33:52 EDT 2008


Author: mikej
Date: Mon May 19 17:33:52 2008
New Revision: 8476

Modified:
   freeswitch/trunk/src/switch_regex.c

Log:
add bounds checks. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/switch_regex.c
==============================================================================
--- freeswitch/trunk/src/switch_regex.c	(original)
+++ freeswitch/trunk/src/switch_regex.c	Mon May 19 17:33:52 2008
@@ -144,6 +144,10 @@
 			z = 0;
 			num = atoi(index);
 
+			if (num < 0 || num > 256) {
+				num = -1;
+			}
+
 			if (pcre_copy_substring(field_data, ovector, match_count, num, replace, sizeof(replace)) > 0) {
 				switch_size_t r;
 				for (r = 0; r < strlen(replace); r++) {



More information about the Freeswitch-svn mailing list