[mapserver-commits] r10645 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Oct 22 16:42:59 EDT 2010
Author: aboudreault
Date: 2010-10-22 13:42:59 -0700 (Fri, 22 Oct 2010)
New Revision: 10645
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/cgiutil.c
trunk/mapserver/cgiutil.h
trunk/mapserver/mapserv.c
Log:
Fixed number of CGI params is limited to 100 (#3583)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2010-10-22 19:50:23 UTC (rev 10644)
+++ trunk/mapserver/HISTORY.TXT 2010-10-22 20:42:59 UTC (rev 10645)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Fixed number of CGI params is limited to 100 (#3583)
+
- Fixed duplicated XML and HTML errors from WFS GetFeature (#3571)
- Support group names for GetLegendGraphic and GetStyles (#3411)
Modified: trunk/mapserver/cgiutil.c
===================================================================
--- trunk/mapserver/cgiutil.c 2010-10-22 19:50:23 UTC (rev 10644)
+++ trunk/mapserver/cgiutil.c 2010-10-22 20:42:59 UTC (rev 10645)
@@ -124,6 +124,7 @@
register int x,m=0;
char *s, *queryString = NULL, *httpCookie = NULL;
int debuglevel;
+ int maxParams = MS_DEFAULT_CGI_PARAMS;
if (getenv2==NULL)
getenv2 = &msGetEnv;
@@ -166,9 +167,10 @@
post_data[--data_len] = '\0';
while( post_data[0] ) {
- if(m >= MS_MAX_CGI_PARAMS) {
- msIO_printf("Too many name/value pairs, aborting.\n");
- exit(0);
+ if(m >= maxParams) {
+ maxParams *= 2;
+ request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
+ request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
}
request->ParamValues[m] = makeword(post_data,'&');
plustospace(request->ParamValues[m]);
@@ -190,10 +192,10 @@
queryString = strdup(s);
for(x=0;queryString[0] != '\0';x++) {
- if(m >= MS_MAX_CGI_PARAMS) {
- msIO_printf("Too many name/value pairs, aborting.\n");
- free(queryString);
- exit(0);
+ if(m >= maxParams) {
+ maxParams *= 2;
+ request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
+ request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
}
request->ParamValues[m] = makeword(queryString,'&');
plustospace(request->ParamValues[m]);
@@ -225,10 +227,10 @@
/* don't modify the string returned by getenv2 */
queryString = strdup(s);
for(x=0;queryString[0] != '\0';x++) {
- if(m >= MS_MAX_CGI_PARAMS) {
- msIO_printf("Too many name/value pairs, aborting.\n");
- free(queryString);
- exit(0);
+ if(m >= maxParams) {
+ maxParams *= 2;
+ request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
+ request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
}
request->ParamValues[m] = makeword(queryString,'&');
plustospace(request->ParamValues[m]);
@@ -249,10 +251,10 @@
httpCookie = strdup(s);
request->httpcookiedata = strdup(s);
for(x=0;httpCookie[0] != '\0';x++) {
- if(m >= MS_MAX_CGI_PARAMS) {
- msIO_printf("Too many name/value pairs, aborting.\n");
- free(httpCookie);
- exit(0);
+ if(m >= maxParams) {
+ maxParams *= 2;
+ request->ParamNames = (char **) realloc(request->ParamNames,sizeof(char *) * maxParams);
+ request->ParamValues = (char **) realloc(request->ParamValues,sizeof(char *) * maxParams);
}
request->ParamValues[m] = makeword(httpCookie,';');
plustospace(request->ParamValues[m]);
Modified: trunk/mapserver/cgiutil.h
===================================================================
--- trunk/mapserver/cgiutil.h 2010-10-22 19:50:23 UTC (rev 10644)
+++ trunk/mapserver/cgiutil.h 2010-10-22 20:42:59 UTC (rev 10645)
@@ -42,7 +42,7 @@
/*
** Misc. defines
*/
-#define MS_MAX_CGI_PARAMS 100
+#define MS_DEFAULT_CGI_PARAMS 100
enum MS_REQUEST_TYPE {MS_GET_REQUEST, MS_POST_REQUEST};
Modified: trunk/mapserver/mapserv.c
===================================================================
--- trunk/mapserver/mapserv.c 2010-10-22 19:50:23 UTC (rev 10644)
+++ trunk/mapserver/mapserv.c 2010-10-22 20:42:59 UTC (rev 10645)
@@ -1208,8 +1208,8 @@
mapserv = msAllocMapServObj();
mapserv->sendheaders = sendheaders; /* override the default if necessary (via command line -nh switch) */
- mapserv->request->ParamNames = (char **) malloc(MS_MAX_CGI_PARAMS*sizeof(char*));
- mapserv->request->ParamValues = (char **) malloc(MS_MAX_CGI_PARAMS*sizeof(char*));
+ mapserv->request->ParamNames = (char **) malloc(MS_DEFAULT_CGI_PARAMS*sizeof(char*));
+ mapserv->request->ParamValues = (char **) malloc(MS_DEFAULT_CGI_PARAMS*sizeof(char*));
if(mapserv->request->ParamNames==NULL || mapserv->request->ParamValues==NULL) {
msSetError(MS_MEMERR, NULL, "mapserv()");
writeError();
More information about the mapserver-commits
mailing list