[mapserver-commits] r8809 - branches/branch-5-2/mapserver

svn at osgeo.org svn at osgeo.org
Wed Mar 18 19:50:01 EDT 2009


Author: sdlime
Date: 2009-03-18 19:50:01 -0400 (Wed, 18 Mar 2009)
New Revision: 8809

Modified:
   branches/branch-5-2/mapserver/mapserv.c
   branches/branch-5-2/mapserver/maptemplate.c
Log:
Changed size_t argument for certain snprintf calls to use a safer sizeof() call.

Modified: branches/branch-5-2/mapserver/mapserv.c
===================================================================
--- branches/branch-5-2/mapserver/mapserv.c	2009-03-18 14:26:47 UTC (rev 8808)
+++ branches/branch-5-2/mapserver/mapserv.c	2009-03-18 23:50:01 UTC (rev 8809)
@@ -1310,7 +1310,7 @@
     loadForm();
  
     if(mapserv->savemap) {
-      snprintf(buffer, 1024, "%s%s%s.map", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id);
+      snprintf(buffer, sizeof(buffer), "%s%s%s.map", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id);
       if(msSaveMap(mapserv->map, buffer) == -1) writeError();
     }
 
@@ -1784,7 +1784,7 @@
         if(msReturnTemplateQuery(mapserv, mapserv->map->web.queryformat, NULL) != MS_SUCCESS) writeError();
           
         if(mapserv->savequery) {
-          snprintf(buffer, 1024, "%s%s%s%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_QUERY_EXTENSION);
+          snprintf(buffer, sizeof(buffer), "%s%s%s%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_QUERY_EXTENSION);
           if((status = msSaveQuery(mapserv->map, buffer)) != MS_SUCCESS) return status;
         }
       }

Modified: branches/branch-5-2/mapserver/maptemplate.c
===================================================================
--- branches/branch-5-2/mapserver/maptemplate.c	2009-03-18 14:26:47 UTC (rev 8808)
+++ branches/branch-5-2/mapserver/maptemplate.c	2009-03-18 23:50:01 UTC (rev 8809)
@@ -3848,7 +3848,7 @@
       image = msDrawMap(mapserv->map, bQueryMap);
 
       if(image) { 
-        snprintf(buffer, 1024, "%s%s%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
+        snprintf(buffer, sizeof(buffer), "%s%s%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
 
         if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
           msFreeImage(image);
@@ -3864,7 +3864,7 @@
       imageObj *image = NULL;
       image = msDrawLegend(mapserv->map, MS_FALSE);
       if(image) { 
-        snprintf(buffer, 1024, "%s%sleg%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
+        snprintf(buffer, sizeof(buffer), "%s%sleg%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
                 
         if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
           msFreeImage(image);
@@ -3880,7 +3880,7 @@
       imageObj *image = NULL;
       image = msDrawScalebar(mapserv->map);
       if(image) {
-        snprintf(buffer, 1024, "%s%ssb%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
+        snprintf(buffer, sizeof(buffer), "%s%ssb%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
         if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
           msFreeImage(image);
           return MS_FALSE;
@@ -3895,7 +3895,7 @@
       imageObj *image;
       image = msDrawReferenceMap(mapserv->map);
       if(image) { 
-        snprintf(buffer, 1024, "%s%sref%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
+        snprintf(buffer, sizeof(buffer), "%s%sref%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
         if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
           msFreeImage(image);
           return MS_FALSE;



More information about the mapserver-commits mailing list