Must really be safe_read(), not full_read()? (was: [PATCH] fix httpd lockup in cgi POSTs)

Denis Vlasenko vda.linux at googlemail.com
Mon Feb 12 21:01:13 UTC 2007


On Monday 12 February 2007 18:09, Matthias Reichl wrote:
> > If this is not sufficient then busybox httpd should line buffer standard
> > input so that it always handles the status line correctly. 
> 
> If I understand the code correctly, it would be sufficient to do
> something like
> 
> if (firstline)
>     count = full_read(inFd, rbuf, 4);
>     /* read 4 bytes so we can check if the line begins with "HTTP" */

So far I am happy with "bbox httpd doesn't support insane cgis
which split their HTTP response" way.

> } else {
>     count = safe_read(inFd, rbuf, PIPESIZE);
> }
> 
> Better yet, do a full line read for the first line or completely
> switch to line buffered input, as you suggested.

Are you suggesting using stdio?
Can't do that, or POSTDATA will break again.

You basically need to _open-code_ buffering here. Than will work.
--
vda



More information about the busybox mailing list