]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_rewrite: Fix a possible NULL pointer dereference in hook_uri2file
authorJoe Orton <jorton@apache.org>
Thu, 6 Jul 2023 12:20:37 +0000 (12:20 +0000)
committerJoe Orton <jorton@apache.org>
Thu, 6 Jul 2023 12:20:37 +0000 (12:20 +0000)
is_absolute_uri() dereferences r->filename in the function body, but
there is no check if r->filename == NULL before.

Submitted by: Luboš Uhliarik <luhliari redhat.com>
Github: closes #355

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910815 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index 1e97d8b75d4fd592c9d59f89174434526c1cb74d..0676804695c8cb3764225d60c84be79a815e6b10 100644 (file)
@@ -4831,8 +4831,8 @@ static int hook_uri2file(request_rec *r)
     }
 
     if (rulestatus) {
-        unsigned skip_absolute = is_absolute_uri(r->filename, NULL);
         apr_size_t flen =  r->filename ? strlen(r->filename) : 0;
+        unsigned skip_absolute = flen ? is_absolute_uri(r->filename, NULL) : 0;
         int to_proxyreq = (flen > 6 && strncmp(r->filename, "proxy:", 6) == 0);
         int will_escape = skip_absolute && (rulestatus != ACTION_NOESCAPE);