[svn-commits] kpfleming: trunk r47642 - in /trunk: ./ main/term.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Nov 14 17:19:35 MST 2006


Author: kpfleming
Date: Tue Nov 14 18:19:35 2006
New Revision: 47642

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47642
Log:
Merged revisions 47641 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47641 | kpfleming | 2006-11-14 18:19:05 -0600 (Tue, 14 Nov 2006) | 2 lines

more formatting cleanup, and avoid running off the end of the string

........

Modified:
    trunk/   (props changed)
    trunk/main/term.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/term.c
URL: http://svn.digium.com/view/asterisk/trunk/main/term.c?view=diff&rev=47642&r1=47641&r2=47642
==============================================================================
--- trunk/main/term.c (original)
+++ trunk/main/term.c Tue Nov 14 18:19:35 2006
@@ -266,28 +266,26 @@
 
 /* filter escape sequences */
 void term_filter_escapes(char *line)
- {
-	 int i;
-   
-	 for (i = 0; i < strlen(line); i++) {
+{
+	int i;
+	int len = strlen(line);
+
+	for (i = 0; i < len; i++) {
 		if (line[i] != ESC)
 			continue;
-		if (line[i + 1] == '\x5b') {
+		if ((i < (len - 2)) &&
+		    (line[i + 1] == 0x5B)) {
 			switch (line[i + 2]) {
-		 	case '\x30':
-			case '\x31':
-			case '\x33':
-				break;
-			default:
-				/* replace ESC with a space */
-				line[i] = ' ';
+		 	case 0x30:
+			case 0x31:
+			case 0x33:
+				continue;
 			}
-		} else {
-			/* replace ESC with a space */
-			line[i] = ' ';
-		}
-	 }
- }
+		}
+		/* replace ESC with a space */
+		line[i] = ' ';
+	}
+}
 
 char *term_prep(void)
 {



More information about the svn-commits mailing list