gnome-games r7639 - in branches/gnome-2-22/glchess: . src/lib/ggz



Author: rancell
Date: Sat May 10 05:39:09 2008
New Revision: 7639
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7639&view=rev

Log:
Fix crash decoding empty GGZ strings (Bug #530579)



Modified:
   branches/gnome-2-22/glchess/ChangeLog
   branches/gnome-2-22/glchess/src/lib/ggz/chess.py

Modified: branches/gnome-2-22/glchess/src/lib/ggz/chess.py
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/ggz/chess.py	(original)
+++ branches/gnome-2-22/glchess/src/lib/ggz/chess.py	Sat May 10 05:39:09 2008
@@ -85,7 +85,9 @@
             return (None, 0)
         
         string = buffer[4:length + 4]
-        if string[-1] == '\x00':
+        
+        # Strip C null characters
+        while string.endswith('\x00'):
             string = string[:-1]
         
         return (string, length + 4)



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