Author: sf
Date: Sat Oct 24 13:29:03 2009
New Revision: 829362
URL: http://svn.apache.org/viewvc?rev=829362&view=rev
Log:
Only allow parens in filename if cachesize is given. Return error otherwise
to catch missing parens.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=829362&r1=829361&r2=829362&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Oct 24 13:29:03 2009
@@ -10,8 +10,8 @@
mod_proxy_ftp: NULL pointer dereference on error paths.
[Stefan Fritsch <sf fritsch.de>, Joe Orton]
- *) mod_socache_shmcb: Only parse cache size in parens at the end of the
- string. Fixes SSLSessionCache directive mis-parsing parens in pathname.
+ *) mod_socache_shmcb: Allow parens in file name if cache size is given.
+ Fixes SSLSessionCache directive mis-parsing parens in pathname.
PR 47945. [Stefan Fritsch]
*) htpasswd: Improve out of disk space handling. PR 30877. [Stefan Fritsch]
Modified: httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c?rev=829362&r1=829361&r2=829362&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_socache_shmcb.c Sat Oct 24 13:29:03 2009
@@ -280,11 +280,20 @@
cp = strrchr(path, '(');
cp2 = path + strlen(path) - 1;
- if (cp && (*cp2 == ')')) {
+ if (cp) {
+ char *endptr;
+ if (*cp2 != ')') {
+ return "Invalid argument: no closing parenthesis or cache size "
+ "missing after pathname with parenthesis";
+ }
*cp++ = '\0';
*cp2 = '\0';
- ctx->shm_size = atoi(cp);
+
+ ctx->shm_size = strtol(cp, &endptr, 10);
+ if (endptr != cp2) {
+ return "Invalid argument: cache size not numerical";
+ }
if (ctx->shm_size < 8192) {
return "Invalid argument: size has to be >= 8192 bytes";
@@ -299,6 +308,9 @@
}
}
+ else if (cp2 >= path && *cp2 == ')') {
+ return "Invalid argument: no opening parenthesis";
+ }
return NULL;
}
|