You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2018/01/03 13:40:26 UTC

svn commit: r1819970 - /httpd/httpd/trunk/modules/filters/mod_proxy_html.c

Author: ylavic
Date: Wed Jan  3 13:40:26 2018
New Revision: 1819970

URL: http://svn.apache.org/viewvc?rev=1819970&view=rev
Log:
mod_proxy_html: don't depend on NUL terminated bucket data.

ap_regexec() wants NUL terminated strings, so use ap_regexec_len() instead.


Modified:
    httpd/httpd/trunk/modules/filters/mod_proxy_html.c

Modified: httpd/httpd/trunk/modules/filters/mod_proxy_html.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_proxy_html.c?rev=1819970&r1=1819969&r2=1819970&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_proxy_html.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_proxy_html.c Wed Jan  3 13:40:26 2018
@@ -669,7 +669,7 @@ static void pstartElement(void *ctxt, co
     }
 }
 
-static meta *metafix(request_rec *r, const char *buf)
+static meta *metafix(request_rec *r, const char *buf, apr_size_t len)
 {
     meta *ret = NULL;
     size_t offs = 0;
@@ -680,7 +680,8 @@ static meta *metafix(request_rec *r, con
     ap_regmatch_t pmatch[2];
     char delim;
 
-    while (!ap_regexec(seek_meta, buf+offs, 2, pmatch, 0)) {
+    while (offs < len &&
+           !ap_regexec_len(seek_meta, buf + offs, len - offs, 2, pmatch, 0)) {
         header = NULL;
         content = NULL;
         p = buf+offs+pmatch[1].rm_eo;
@@ -1004,7 +1005,7 @@ static apr_status_t proxy_html_filter(ap
                                   "Unsupported parser opts %x", xmlopts);
 #endif
                 if (ctxt->cfg->metafix)
-                    m = metafix(f->r, buf);
+                    m = metafix(f->r, buf, bytes);
                 if (m) {
                     consume_buffer(ctxt, buf, m->start, 0);
                     consume_buffer(ctxt, buf+m->end, bytes-m->end, 0);