On Jul 6, 2005, at 2:22 PM, Joe Orton wrote:

On Wed, Jul 06, 2005 at 11:45:21AM -0500, William Rowe wrote:
...

+            else {
+                char *len_end;
+                errno = 0;
+                c->len = ap_strtol(content_length, &len_end, 10);

...

+ if (errno || (c->len < 0) || (len_end && *len_end)) {


You should copy the logic used on the trunk to get the correct tests for
a strtol parse error:

  errno || len_end == content_length || *len_end || c->len < 0


The len_end == content_length just means that there was no digits
seen (possibly a blank)... not sure if we should consider that
an error. That's why in all other places we've used
the (len_end && *len_end) check, which ensures that
it's valid *and* that it's seen an invalid char. ap_strtol(" "...)
returns 0 but isn't an "error" (though in this context,
I see your point).

Reply via email to