httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: parser-related sigsegv
Date Fri, 22 Apr 2005 02:29:39 GMT
"Philip M. Gollucci" <pgollucci@p6m7g8.com> writes:

[...]

> This patch fixes it for me:
> Index: param.c
> ===================================================================
> --- param.c     (revision 164006)
> +++ param.c     (working copy)
> @@ -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;
>

Nice work Philip!  I wrote that bug when I was trying to balance 
apreq_param_make and apreq_cookie_make.  Keeping with that
goal, and based on your idea above, here's the corresponding patch 
for apreq_cookie_make. If it looks ok to you, I'll commit them both.

Index: library/cookie.c
===================================================================
--- library/cookie.c	(revision 161816)
+++ library/cookie.c	(working copy)
@@ -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,7 +144,7 @@
     v->data[vlen] = 0;
     v->dlen = vlen;
     v->name = v->data + vlen + 1;
-    if (name != NULL)
+    if (nlen && name != NULL)
         memcpy (v->name, name, nlen);
     v->name[nlen] = 0;
     v->nlen = nlen;

-- 
Joe Schaefer


Mime
View raw message