You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/05/20 02:53:14 UTC

svn commit: r171027 - in /httpd/apreq/trunk: include/apreq_version.h library/t/util.c library/util.c

Author: joes
Date: Thu May 19 17:53:13 2005
New Revision: 171027

URL: http://svn.apache.org/viewcvs?rev=171027&view=rev
Log:
Prevent apreq_header_attribute from backtracking
before the start of its hdr argument.

Modified:
    httpd/apreq/trunk/include/apreq_version.h
    httpd/apreq/trunk/library/t/util.c
    httpd/apreq/trunk/library/util.c

Modified: httpd/apreq/trunk/include/apreq_version.h
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/include/apreq_version.h?rev=171027&r1=171026&r2=171027&view=diff
==============================================================================
--- httpd/apreq/trunk/include/apreq_version.h (original)
+++ httpd/apreq/trunk/include/apreq_version.h Thu May 19 17:53:13 2005
@@ -61,7 +61,7 @@
 #define APREQ_MINOR_VERSION       1
 
 /** patch level */
-#define APREQ_PATCH_VERSION       0
+#define APREQ_PATCH_VERSION       1
 
 /** 
  *  This symbol is defined for internal, "development" copies of libapreq.

Modified: httpd/apreq/trunk/library/t/util.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/t/util.c?rev=171027&r1=171026&r2=171027&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/util.c (original)
+++ httpd/apreq/trunk/library/t/util.c Thu May 19 17:53:13 2005
@@ -244,7 +244,19 @@
 
 static void test_header_attribute(dAT)
 {
-
+    const char hdr[] = "filename=\"filename=foo\" filename=\"quux.txt\"";
+    const char *val;
+    apr_size_t vlen;
+
+    AT_int_eq(apreq_header_attribute(hdr+4, "name", 4, &val, &vlen),
+              APR_SUCCESS);
+    AT_int_eq(vlen, 12);
+    AT_mem_eq("filename=foo", val, 12);
+
+    AT_int_eq(apreq_header_attribute(hdr+4, "filename", 8, &val, &vlen),
+              APR_SUCCESS);
+    AT_int_eq(vlen, 8);
+    AT_mem_eq("quux.txt", val, 8);
 
 }
 
@@ -276,7 +288,7 @@
         { dT(test_join, 0) },
         { dT(test_brigade_fwrite, 0) },
         { dT(test_file_mktemp, 0) },
-        { dT(test_header_attribute, 0) },
+        { dT(test_header_attribute, 6) },
         { dT(test_brigade_concat, 0) },
     };
 

Modified: httpd/apreq/trunk/library/util.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/util.c?rev=171027&r1=171026&r2=171027&view=diff
==============================================================================
--- httpd/apreq/trunk/library/util.c (original)
+++ httpd/apreq/trunk/library/util.c Thu May 19 17:53:13 2005
@@ -1077,7 +1077,7 @@
             }
         }
 
-        if (strncasecmp(key, name, nlen) == 0) {
+        if (key >= hdr && strncasecmp(key, name, nlen) == 0) {
             *vlen = v - *val;
             if (key == hdr || ! is_2616_token(key[-1]))
                 return APR_SUCCESS;