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 2003/09/18 02:38:24 UTC

cvs commit: httpd-apreq-2/t parsers.c

joes        2003/09/17 17:38:24

  Modified:    t        parsers.c
  Log:
  apr_brigade_pflatten() does not null-terminate the result string.
  
  Revision  Changes    Path
  1.6       +4 -3      httpd-apreq-2/t/parsers.c
  
  Index: parsers.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/t/parsers.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- parsers.c	27 Jun 2003 11:41:07 -0000	1.5
  +++ parsers.c	18 Sep 2003 00:38:24 -0000	1.6
  @@ -111,7 +111,7 @@
   static void parse_multipart(CuTest *tc)
   {
       const char *val;
  -    apr_size_t dummy;
  +    apr_size_t len;
       apr_table_t *t;
       apr_status_t rv;
       apreq_request_t *req = apreq_request(APREQ_MFD_ENCTYPE
  @@ -145,8 +145,9 @@
       CuAssertStrEquals(tc, "file1.txt", val);
       t = apreq_value_to_param(apreq_strtoval(val))->info;
       bb = apreq_value_to_param(apreq_strtoval(val))->bb;
  -    apr_brigade_pflatten(bb, (char **)&val, &dummy, p);
  -    CuAssertStrEquals(tc,"... contents of file1.txt ...", val);
  +    apr_brigade_pflatten(bb, (char **)&val, &len, p);
  +    CuAssertIntEquals(tc,strlen("... contents of file1.txt ..."), len);
  +    CuAssertStrNEquals(tc,"... contents of file1.txt ...", val, len);
       val = apr_table_get(t, "content-type");
       CuAssertStrEquals(tc, "text/plain", val);
   }