Return-Path: Delivered-To: apmail-httpd-apreq-cvs-archive@www.apache.org Received: (qmail 40675 invoked from network); 18 Jul 2004 19:45:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 Jul 2004 19:45:24 -0000 Received: (qmail 72146 invoked by uid 500); 18 Jul 2004 19:45:23 -0000 Delivered-To: apmail-httpd-apreq-cvs-archive@httpd.apache.org Received: (qmail 72120 invoked by uid 500); 18 Jul 2004 19:45:23 -0000 Mailing-List: contact apreq-cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: apreq-dev@httpd.apache.org List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list apreq-cvs@httpd.apache.org Received: (qmail 72107 invoked by uid 500); 18 Jul 2004 19:45:23 -0000 Delivered-To: apmail-httpd-apreq-2-cvs@apache.org Received: (qmail 72104 invoked by uid 99); 18 Jul 2004 19:45:23 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Sun, 18 Jul 2004 12:45:22 -0700 Received: (qmail 40666 invoked by uid 1221); 18 Jul 2004 19:45:21 -0000 Date: 18 Jul 2004 19:45:21 -0000 Message-ID: <20040718194521.40665.qmail@minotaur.apache.org> From: joes@apache.org To: httpd-apreq-2-cvs@apache.org Subject: cvs commit: httpd-apreq-2/t params.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N joes 2004/07/18 12:45:21 Modified: src apreq.c t params.c Log: apreq_header_attribute returns APR_EGENERAL if the header is missing a trailing quote. And don't advance hdr past v because *v could be 0 here. Also rename memmem test 'test_memmem' to avoid symbol conflict with 's memmem. Revision Changes Path 1.45 +4 -2 httpd-apreq-2/src/apreq.c Index: apreq.c =================================================================== RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- apreq.c 17 Jul 2004 17:05:27 -0000 1.44 +++ apreq.c 18 Jul 2004 19:45:21 -0000 1.45 @@ -807,6 +807,8 @@ break; } } + /* bad attr: no terminating quote found */ + return APR_EGENERAL; } else { /* value is not wrapped in quotes */ @@ -827,13 +829,13 @@ finish: if (strncasecmp(key, name, nlen) == 0 - && (key == hdr || !apr_isalpha(key[-1]))) + && (key == hdr || !apr_isalnum(key[-1]))) { *vlen = v - *val; return APR_SUCCESS; } else - hdr = v + 1; + hdr = v; } return APR_NOTFOUND; 1.19 +14 -3 httpd-apreq-2/t/params.c Index: params.c =================================================================== RCS file: /home/cvs/httpd-apreq-2/t/params.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- params.c 18 Jul 2004 05:27:27 -0000 1.18 +++ params.c 18 Jul 2004 19:45:21 -0000 1.19 @@ -91,7 +91,7 @@ static void header_attributes(CuTest *tc) { - const char hdr[] = "text/plain; boundary=\"-foo-\", charset=ISO-8859-1"; + const char *hdr = "text/plain; boundary=\"-foo-\", charset=ISO-8859-1"; const char *val; apr_size_t vlen; apr_status_t s; @@ -112,6 +112,17 @@ CuAssertIntEquals(tc, 10, vlen); CuAssertStrNEquals(tc, "ISO-8859-1", val, 10); + hdr = "max-age=20; no-quote=\"..."; + + s = apreq_header_attribute(hdr, "max-age", 7, &val, &vlen); + CuAssertIntEquals(tc, APR_SUCCESS, s); + CuAssertIntEquals(tc, 2, vlen); + CuAssertStrNEquals(tc, "20", val, 2); + + s = apreq_header_attribute(hdr, "no-quote", 8, &val, &vlen); + CuAssertIntEquals(tc, APR_EGENERAL, s); + + } static void make_values(CuTest *tc) @@ -186,7 +197,7 @@ } } -static void memmem(CuTest *tc) +static void test_memmem(CuTest *tc) { char *hay = apr_palloc(p,29); char *partial, *full; @@ -221,7 +232,7 @@ SUITE_ADD_TEST(suite, make_values); SUITE_ADD_TEST(suite, quote_strings); SUITE_ADD_TEST(suite, make_param); - SUITE_ADD_TEST(suite, memmem); + SUITE_ADD_TEST(suite, test_memmem); return suite; }