httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r164254 - in /httpd/apreq/trunk/library: cookie.c param.c t/cookie.c t/parsers.c
Date Fri, 22 Apr 2005 16:50:59 GMT
Author: joes
Date: Fri Apr 22 09:50:58 2005
New Revision: 164254

URL: http://svn.apache.org/viewcvs?rev=164254&view=rev
Log:
Fix mfd parser segfault caused by empty param name.

joes carried Philip's fix over to cookies,
and added additional tests.

Reported by: Igor Shevchenko
Submitted by: Philip Gollucci
Reviewed by: Philip Gollucci, joes

Modified:
    httpd/apreq/trunk/library/cookie.c
    httpd/apreq/trunk/library/param.c
    httpd/apreq/trunk/library/t/cookie.c
    httpd/apreq/trunk/library/t/parsers.c

Modified: httpd/apreq/trunk/library/cookie.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/cookie.c?rev=164254&r1=164253&r2=164254&view=diff
==============================================================================
--- httpd/apreq/trunk/library/cookie.c (original)
+++ httpd/apreq/trunk/library/cookie.c Fri Apr 22 09:50:58 2005
@@ -134,7 +134,7 @@
 
     c = apr_palloc(p, nlen + vlen + 1 + sizeof *c);
 
-    if (c == NULL || nlen == 0)
+    if (c == NULL)
         return NULL;
 
     *(const apreq_value_t **)&v = &c->v;
@@ -144,8 +144,8 @@
     v->data[vlen] = 0;
     v->dlen = vlen;
     v->name = v->data + vlen + 1;
-    if (name != NULL)
-        memcpy (v->name, name, nlen);
+    if (nlen && name != NULL)
+        memcpy(v->name, name, nlen);
     v->name[nlen] = 0;
     v->nlen = nlen;
     /* session cookie is the default */

Modified: httpd/apreq/trunk/library/param.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/param.c?rev=164254&r1=164253&r2=164254&view=diff
==============================================================================
--- httpd/apreq/trunk/library/param.c (original)
+++ httpd/apreq/trunk/library/param.c Fri Apr 22 09:50:58 2005
@@ -36,7 +36,7 @@
 
     param = apr_palloc(p, nlen + vlen + 1 + sizeof *param);
 
-    if (param == NULL || nlen == 0)
+    if (param == NULL)
         return NULL;
 
     param->info = NULL;

Modified: httpd/apreq/trunk/library/t/cookie.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/t/cookie.c?rev=164254&r1=164253&r2=164254&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/cookie.c (original)
+++ httpd/apreq/trunk/library/t/cookie.c Fri Apr 22 09:50:58 2005
@@ -24,7 +24,7 @@
 static const char nscookies[] = "a=1; foo=bar; fl=left; fr=right;bad; "
                                 "ns=foo=1&bar=2,frl=right-left; "
                                 "flr=left-right; fll=left-left; "
-                                "good_one=1;bad";
+                                "good_one=1;=;bad";
 
 static const char rfccookies[] = "$Version=1; first=a;$domain=quux;second=be,"
                                  "$Version=1;third=cie";
@@ -70,6 +70,7 @@
     AT_str_eq(apr_table_get(jar,"frl"), "right-left");
     AT_str_eq(apr_table_get(jar,"flr"), "left-right");
     AT_str_eq(apr_table_get(jar,"fll"), "left-left");
+    AT_is_null(apr_table_get(jar,""));
 }
 
 
@@ -177,7 +178,7 @@
     at_test_t test_list [] = {
         { dT(jar_make, 4) },
         { dT(jar_get_rfc, 6), "1 3 5" },
-        { dT(jar_get_ns, 9) },
+        { dT(jar_get_ns, 10) },
         { dT(netscape_cookie, 7) },
         { dT(rfc_cookie, 6) },
         { dT(ua_version, 2) }

Modified: httpd/apreq/trunk/library/t/parsers.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/t/parsers.c?rev=164254&r1=164253&r2=164254&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/parsers.c (original)
+++ httpd/apreq/trunk/library/t/parsers.c Fri Apr 22 09:50:58 2005
@@ -37,6 +37,11 @@
 "content-disposition: form-data; name=\"pics\"; filename=\"file1.txt\"" CRLF
 "Content-Type: text/plain" CRLF CRLF
 "... contents of file1.txt ..." CRLF CRLF
+"--AaB03x" CRLF
+"content-disposition: form-data; name=\"\"" CRLF
+"content-type: text/plain;charset=windows-1250" CRLF
+"content-transfer-encoding: quoted-printable" CRLF CRLF
+"Joe owes =80100." CRLF
 "--AaB03x--" CRLF;
 
 static char xml_data[] =
@@ -221,7 +226,7 @@
             AT_int_eq(rv, (j < strlen(form_data)) ? APR_INCOMPLETE : APR_SUCCESS);
             rv = apreq_parser_run(parser, body, tail);
             AT_int_eq(rv, APR_SUCCESS);
-            AT_int_eq(apr_table_elts(body)->nelts, 2);
+            AT_int_eq(apr_table_elts(body)->nelts, 3);
 
             val = apr_table_get(body,"field1");
             AT_str_eq(val, "Joe owes =80100.");



Mime
View raw message