moserial r11 - in trunk: . src



Author: mjc
Date: Thu Mar 12 15:14:40 2009
New Revision: 11
URL: http://svn.gnome.org/viewvc/moserial?rev=11&view=rev

Log:
2009-03-12  Michael J. Chudobiak  <mjc svn gnome org>

        * src/MainWindow.vala: 
        Validate all characters appended to text buffers.



Modified:
   trunk/ChangeLog
   trunk/src/MainWindow.vala

Modified: trunk/src/MainWindow.vala
==============================================================================
--- trunk/src/MainWindow.vala	(original)
+++ trunk/src/MainWindow.vala	Thu Mar 12 15:14:40 2009
@@ -244,11 +244,20 @@
         }
 	
 
-
         private void insertBufferEnd (TextBuffer buf, string s) {
                 TextIter iter;
+		int i;
+		var builder = new StringBuilder();
+
+		for (i=0;i<s.length;i++) {
+			unichar c = s.get_char();
+			if (c.isprint() || c.isspace())
+				builder.append_unichar(c);	
+			s=s.next_char();
+		}
+
                 buf.get_end_iter(out iter);
-                buf.insert(iter, s, (int)s.length);
+                buf.insert(iter, builder.str, (int)builder.str.length);
         }
 
         public void sendString(Widget w) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]