mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Fix a bunch of cases where the return code of the regex compiler
was not checked properly. This affects: mod_setenvif, mod_usertrack, mod_proxy, mod_proxy_ftp and core. PR: 28218 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103328 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev
|
|||||||
|
|
||||||
[Remove entries to the current 2.0 section below, when backported]
|
[Remove entries to the current 2.0 section below, when backported]
|
||||||
|
|
||||||
|
*) Fix a bunch of cases where the return code of the regex compiler
|
||||||
|
was not checked properly. This affects: mod_setenvif, mod_usertrack,
|
||||||
|
mod_proxy, mod_proxy_ftp and core. PR 28218. [Andr<64> Malo]
|
||||||
|
|
||||||
*) mod_usertrack: Escape the cookie name before pasting into the
|
*) mod_usertrack: Escape the cookie name before pasting into the
|
||||||
regexp. [Andr<64> Malo]
|
regexp. [Andr<64> Malo]
|
||||||
|
|
||||||
|
@@ -172,11 +172,12 @@ static int is_header_regex(apr_pool_t *p, const char* name)
|
|||||||
*/
|
*/
|
||||||
regex_t *preg = ap_pregcomp(p, "^[-A-Za-z0-9_]*$",
|
regex_t *preg = ap_pregcomp(p, "^[-A-Za-z0-9_]*$",
|
||||||
(REG_EXTENDED | REG_NOSUB ));
|
(REG_EXTENDED | REG_NOSUB ));
|
||||||
if (preg) {
|
ap_assert(preg != NULL);
|
||||||
|
|
||||||
if (ap_regexec(preg, name, 0, NULL, 0)) {
|
if (ap_regexec(preg, name, 0, NULL, 0)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -200,6 +200,7 @@ static void set_and_comp_regexp(cookie_dir_rec *dcfg,
|
|||||||
"=([^;,]+)", NULL);
|
"=([^;,]+)", NULL);
|
||||||
|
|
||||||
dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
|
dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
|
||||||
|
ap_assert(dcfg->regexp != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spot_cookie(request_rec *r)
|
static int spot_cookie(request_rec *r)
|
||||||
|
@@ -946,6 +946,9 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
|
|||||||
*/
|
*/
|
||||||
if (thiscmd->cmd_data) { /* <ProxyMatch> */
|
if (thiscmd->cmd_data) { /* <ProxyMatch> */
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(cmd->path, "~")) {
|
else if (!strcmp(cmd->path, "~")) {
|
||||||
cmd->path = ap_getword_conf(cmd->pool, &arg);
|
cmd->path = ap_getword_conf(cmd->pool, &arg);
|
||||||
@@ -954,6 +957,9 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
|
|||||||
if (strncasecmp(cmd->path, "proxy:", 6))
|
if (strncasecmp(cmd->path, "proxy:", 6))
|
||||||
cmd->path += 6;
|
cmd->path += 6;
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize our config and fetch it */
|
/* initialize our config and fetch it */
|
||||||
|
@@ -427,6 +427,7 @@ apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *in)
|
|||||||
|
|
||||||
/* Compile the output format of "ls -s1" as a fallback for non-unix ftp listings */
|
/* Compile the output format of "ls -s1" as a fallback for non-unix ftp listings */
|
||||||
re = ap_pregcomp(p, LS_REG_PATTERN, REG_EXTENDED);
|
re = ap_pregcomp(p, LS_REG_PATTERN, REG_EXTENDED);
|
||||||
|
ap_assert(re != NULL);
|
||||||
|
|
||||||
/* get a complete line */
|
/* get a complete line */
|
||||||
/* if the buffer overruns - throw data away */
|
/* if the buffer overruns - throw data away */
|
||||||
|
@@ -1651,9 +1651,15 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
|
|||||||
if (!cmd->path)
|
if (!cmd->path)
|
||||||
return "<Directory ~ > block must specify a path";
|
return "<Directory ~ > block must specify a path";
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
|
else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(cmd->path, "/") == 0)
|
else if (!strcmp(cmd->path, "/") == 0)
|
||||||
{
|
{
|
||||||
@@ -1735,10 +1741,16 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
|
|||||||
|
|
||||||
if (thiscmd->cmd_data) { /* <LocationMatch> */
|
if (thiscmd->cmd_data) { /* <LocationMatch> */
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(cmd->path, "~")) {
|
else if (!strcmp(cmd->path, "~")) {
|
||||||
cmd->path = ap_getword_conf(cmd->pool, &arg);
|
cmd->path = ap_getword_conf(cmd->pool, &arg);
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize our config and fetch it */
|
/* initialize our config and fetch it */
|
||||||
@@ -1797,10 +1809,16 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg)
|
|||||||
|
|
||||||
if (thiscmd->cmd_data) { /* <FilesMatch> */
|
if (thiscmd->cmd_data) { /* <FilesMatch> */
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(cmd->path, "~")) {
|
else if (!strcmp(cmd->path, "~")) {
|
||||||
cmd->path = ap_getword_conf(cmd->pool, &arg);
|
cmd->path = ap_getword_conf(cmd->pool, &arg);
|
||||||
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
|
||||||
|
if (!r) {
|
||||||
|
return "Regex could not be compiled";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char *newpath;
|
char *newpath;
|
||||||
|
Reference in New Issue
Block a user