[mapserver-commits] r11429 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 31 09:57:28 EDT 2011


Author: tbonfort
Date: 2011-03-31 06:57:28 -0700 (Thu, 31 Mar 2011)
New Revision: 11429

Modified:
   trunk/mapserver/mapsymbol.c
Log:
check return value of fread()


Modified: trunk/mapserver/mapsymbol.c
===================================================================
--- trunk/mapserver/mapsymbol.c	2011-03-31 13:53:58 UTC (rev 11428)
+++ trunk/mapserver/mapsymbol.c	2011-03-31 13:57:28 UTC (rev 11429)
@@ -231,7 +231,11 @@
         file_len = ftell(stream);
         rewind(stream);
         s->svg_text = (char*)malloc(sizeof(char) * file_len);
-        fread(s->svg_text, file_len, 1, stream);
+        if(1 != fread(s->svg_text, file_len, 1, stream)) {
+          msSetError(MS_IOERR, "failed to read %d bytes from svg file %s", "loadSymbol()", file_len, s->full_pixmap_path);
+          free(s->svg_text);
+          return -1;
+        }
         fclose(stream);
 	    break;
       }



More information about the mapserver-commits mailing list