[prev in list] [next in list] [prev in thread] [next in thread]
List: mapserver-commits
Subject: [mapserver-commits] r11430 - trunk/mapserver
From: svn () osgeo ! org
Date: 2011-03-31 14:12:42
Message-ID: 20110331141242.5C6F43904F8 () trac ! osgeo ! org
[Download RAW message or body]
Author: tbonfort
Date: 2011-03-31 07:12:42 -0700 (Thu, 31 Mar 2011)
New Revision: 11430
Modified:
trunk/mapserver/maptemplate.c
Log:
check return value of fread, and close opened file case of error
Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c 2011-03-31 13:57:28 UTC (rev 11429)
+++ trunk/mapserver/maptemplate.c 2011-03-31 14:12:42 UTC (rev 11430)
@@ -3085,13 +3085,19 @@
if(!file) {
msSetError(MS_IOERR, "Error while allocating memory for template file.", \
"generateLegendTemplate()"); + fclose(stream);
return NULL;
}
/*
* Read all the template file
*/
- fread(file, 1, length, stream);
+ if( 1 != fread(file, length, 1, stream)) {
+ msSetError(MS_IOERR, "Error while reading template file.", \
"generateLegendTemplate()"); + free(file);
+ fclose(stream);
+ return NULL;
+ }
file[length] = '\0';
if(msValidateContexts(mapserv->map) != MS_SUCCESS) return NULL; /* make sure \
there are no recursive REQUIRES or LABELREQUIRES expressions */
_______________________________________________
mapserver-commits mailing list
mapserver-commits@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic