[mapserver-commits] r10659 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Oct 24 11:20:39 EDT 2010


Author: aboudreault
Date: 2010-10-24 08:20:39 -0700 (Sun, 24 Oct 2010)
New Revision: 10659

Modified:
   trunk/mapserver/cgiutil.c
Log:
Added realloc check for cgi params

Modified: trunk/mapserver/cgiutil.c
===================================================================
--- trunk/mapserver/cgiutil.c	2010-10-24 01:21:11 UTC (rev 10658)
+++ trunk/mapserver/cgiutil.c	2010-10-24 15:20:39 UTC (rev 10659)
@@ -171,6 +171,10 @@
           maxParams *= 2;
           request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
           request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
+          if( (request->ParamNames == NULL) || (request->ParamValues ==  NULL) ) {
+              msIO_printf("Out of memory trying to allocate name/value pairs.\n");
+              exit(1);
+          }
         }
         request->ParamValues[m] = makeword(post_data,'&');
         plustospace(request->ParamValues[m]);
@@ -196,6 +200,10 @@
           maxParams *= 2;
           request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
           request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
+          if( (request->ParamNames == NULL) || (request->ParamValues ==  NULL) ) {
+              msIO_printf("Out of memory trying to allocate name/value pairs.\n");
+              exit(1);
+          }
         } 
         request->ParamValues[m] = makeword(queryString,'&'); 
         plustospace(request->ParamValues[m]);
@@ -231,6 +239,10 @@
             maxParams *= 2;
             request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
             request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
+            if( (request->ParamNames == NULL) || (request->ParamValues ==  NULL) ) {
+                msIO_printf("Out of memory trying to allocate name/value pairs.\n");
+                exit(1);
+            }
           } 
           request->ParamValues[m] = makeword(queryString,'&');
           plustospace(request->ParamValues[m]);
@@ -255,6 +267,10 @@
           maxParams *= 2;
           request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
           request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
+          if( (request->ParamNames == NULL) || (request->ParamValues ==  NULL) ) {
+              msIO_printf("Out of memory trying to allocate name/value pairs.\n");
+              exit(1);
+          }
       }
       request->ParamValues[m] = makeword(httpCookie,';');
       plustospace(request->ParamValues[m]);



More information about the mapserver-commits mailing list