[GRASS-SVN] r61998 - grass/trunk/lib/python/pygrass/messages

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 16 09:40:13 PDT 2014


Author: huhabla
Date: 2014-09-16 09:40:13 -0700 (Tue, 16 Sep 2014)
New Revision: 61998

Modified:
   grass/trunk/lib/python/pygrass/messages/__init__.py
Log:
pygrass messages: Reducing the size of the string passed to the libgis messaging functions to avoid buffer overflows

Modified: grass/trunk/lib/python/pygrass/messages/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/messages/__init__.py	2014-09-16 16:38:33 UTC (rev 61997)
+++ grass/trunk/lib/python/pygrass/messages/__init__.py	2014-09-16 16:40:13 UTC (rev 61998)
@@ -85,19 +85,40 @@
         elif message_type == "DEBUG":
             level = data[1]
             message = data[2]
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_debug(level, message)
         elif message_type == "VERBOSE":
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_verbose_message(message)
         elif message_type == "INFO":
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_message(message)
         elif message_type == "IMPORTANT":
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_important_message(message)
         elif message_type == "WARNING":
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_warning(message)
         elif message_type == "ERROR":
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_important_message("ERROR: %s"%message)
         # This is for testing only
         elif message_type == "FATAL":
+            # libgis limitation
+            if len(message) >= 2000:
+                messgae = message[:1999]
             libgis.G_fatal_error(message)
 
         lock.release()



More information about the grass-commit mailing list