[mapserver-commits] r12908 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Dec 22 20:46:37 EST 2011


Author: warmerdam
Date: 2011-12-22 17:46:37 -0800 (Thu, 22 Dec 2011)
New Revision: 12908

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapio.c
Log:
avoid divide by zero in io functions (#4135)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-12-22 18:19:03 UTC (rev 12907)
+++ trunk/mapserver/HISTORY.TXT	2011-12-23 01:46:37 UTC (rev 12908)
@@ -131,6 +131,8 @@
 
 - Initialize the scalebar image color to transparent by default (#3957)
 
+- Do not divide by zero in io read/write funcs (#4135)
+
 IMPORTANT SECURITY FIX:
 
 -  Fixes to prevent SQL injections through OGC filter encoding (in WMS, WFS 

Modified: trunk/mapserver/mapio.c
===================================================================
--- trunk/mapserver/mapio.c	2011-12-22 18:19:03 UTC (rev 12907)
+++ trunk/mapserver/mapio.c	2011-12-23 01:46:37 UTC (rev 12908)
@@ -450,6 +450,9 @@
 {
     msIOContext *context;
 
+    if( size == 0 || nmemb == 0 )
+      return 0;
+
     context = msIO_getHandler( fp );
     if( context == NULL )
         return fwrite( data, size, nmemb, fp );
@@ -466,6 +469,9 @@
 {
     msIOContext *context;
 
+    if( size == 0 || nmemb == 0 )
+      return 0;
+
     context = msIO_getHandler( fp );
     if( context == NULL )
         return fread( data, size, nmemb, fp );



More information about the mapserver-commits mailing list