You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/12/30 21:21:07 UTC
[PATCH] I'm a dummy, even considering the proxy...
recent ap_snprintf changes to not do anything if len==0 broke this in a
noticible way. The original breaking was me back in 1.2bmumble with my
big patch.
Index: proxy_util.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
retrieving revision 1.38
diff -u -r1.38 proxy_util.c
--- proxy_util.c 1997/12/30 15:10:53 1.38
+++ proxy_util.c 1997/12/30 20:20:34
@@ -338,9 +338,9 @@
if (mon == 12)
return x;
- if (strlen(x) < 31)
- x = palloc(p, 31);
- ap_snprintf(x, strlen(x) + 1, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday,
+ if (strlen(x) < 30)
+ x = palloc(p, 30);
+ ap_snprintf(x, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday,
months[mon], year, hour, min, sec);
return x;
}
Re: [PATCH] I'm a dummy, even considering the proxy...
Posted by Marc Slemko <ma...@worldgate.com>.
On Tue, 30 Dec 1997, Dean Gaudet wrote:
> Hey I don't see the len == 0 breakage, but +1 anyway because it's
> definately a bug fix.
if strlen(x) is too small, it will palloc() a new block. That will have
some arbitrary strlen() (normally 0 though). That means the snprintf will
be passed a size of 0 right after it... before that was fine.
This only happens when converting between different date formats or
something.
>
> Dean
>
> On Tue, 30 Dec 1997, Marc Slemko wrote:
>
> > recent ap_snprintf changes to not do anything if len==0 broke this in a
> > noticible way. The original breaking was me back in 1.2bmumble with my
> > big patch.
> >
> > Index: proxy_util.c
> > ===================================================================
> > RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
> > retrieving revision 1.38
> > diff -u -r1.38 proxy_util.c
> > --- proxy_util.c 1997/12/30 15:10:53 1.38
> > +++ proxy_util.c 1997/12/30 20:20:34
> > @@ -338,9 +338,9 @@
> > if (mon == 12)
> > return x;
> >
> > - if (strlen(x) < 31)
> > - x = palloc(p, 31);
> > - ap_snprintf(x, strlen(x) + 1, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday,
> > + if (strlen(x) < 30)
> > + x = palloc(p, 30);
> > + ap_snprintf(x, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday,
> > months[mon], year, hour, min, sec);
> > return x;
> > }
> >
> >
>
Re: [PATCH] I'm a dummy, even considering the proxy...
Posted by Dean Gaudet <dg...@arctic.org>.
Hey I don't see the len == 0 breakage, but +1 anyway because it's
definately a bug fix.
Dean
On Tue, 30 Dec 1997, Marc Slemko wrote:
> recent ap_snprintf changes to not do anything if len==0 broke this in a
> noticible way. The original breaking was me back in 1.2bmumble with my
> big patch.
>
> Index: proxy_util.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
> retrieving revision 1.38
> diff -u -r1.38 proxy_util.c
> --- proxy_util.c 1997/12/30 15:10:53 1.38
> +++ proxy_util.c 1997/12/30 20:20:34
> @@ -338,9 +338,9 @@
> if (mon == 12)
> return x;
>
> - if (strlen(x) < 31)
> - x = palloc(p, 31);
> - ap_snprintf(x, strlen(x) + 1, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday,
> + if (strlen(x) < 30)
> + x = palloc(p, 30);
> + ap_snprintf(x, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday,
> months[mon], year, hour, min, sec);
> return x;
> }
>
>