[svn-commits] anthonyl: branch anthonyl/escape-filter2 r47472 - /team/anthonyl/escape-filte...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Nov 10 14:33:38 MST 2006


Author: anthonyl
Date: Fri Nov 10 15:33:37 2006
New Revision: 47472

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47472
Log:
another update

Modified:
    team/anthonyl/escape-filter2/main/utils.c

Modified: team/anthonyl/escape-filter2/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/escape-filter2/main/utils.c?view=diff&rev=47472&r1=47471&r2=47472
==============================================================================
--- team/anthonyl/escape-filter2/main/utils.c (original)
+++ team/anthonyl/escape-filter2/main/utils.c Fri Nov 10 15:33:37 2006
@@ -1005,28 +1005,36 @@
 	 int tamper = 0;
 	 char *p;
 
-	 p = ast_calloc(1,strlen(line));
-
+	 
+	 p = ast_calloc(1,strlen(line)+1);
+		
 	 if (!p)
 		 return NULL;
 	 
 	 for (i=0;i<strlen(line);i++) {
 		 if (line[i] == '\x1B') {					 
 			 if ( line[i+1] == '\x5b') {
-				 if (line[i+2] != 30 || line[i+2] != 33) {
-					 tamper = 1;
+				 switch (line[i+2]) {
+				 case '\x30':
+					 break;
+				 case '\x31':
+					 break;
+				 case '\x33':
+					 break;
+				 default:
+					 ast_log(LOG_WARNING, "Someone tried to pass malformed data through your terminal\n"); 
+					 tamper=1;
+					 break;
 				 }
-				 
-			 } else 
-				 tamper = 1;
-			 
+			 } else
+				 continue;
+
 		 }
+		 if (tamper)
+			 continue;
 		 p[ii] = line[i];
 		 ii++;
 	 }
- 
-	 if (tamper == 1) 
-		 p[0] = '\0';
-	 
+
 	 return p;
  }



More information about the svn-commits mailing list