>I recently checked the slowcgi(8) and found that it might have an issue
>when buf_pos is at the end of buffer and buf_len is zero.
>
>Am I right?

It seems that all fastcgi blocks are aligned in 8-bytes and buffer size
is 8+65535+255 = 65798 bytes which is not aligned in 8-bytes. It seems
that slowcgi has no problem with aligned data, but I think in general
slowcgi should not assume that all blocks are aligned in 8-bytes.

>Index: slowcgi.c
>===================================================================
>RCS file: /cvs/src/usr.sbin/slowcgi/slowcgi.c,v
>retrieving revision 1.50
>diff -u -p -r1.50 slowcgi.c
>--- slowcgi.c  4 Sep 2016 14:40:34 -0000       1.50
>+++ slowcgi.c  2 Jan 2017 12:52:01 -0000
>@@ -674,8 +674,8 @@ slowcgi_request(int fd, short events, vo
>       /* Make space for further reads */
>       if (c->buf_len > 0) {
>               bcopy(c->buf + c->buf_pos, c->buf, c->buf_len);
>-              c->buf_pos = 0;
>       }
>+      c->buf_pos = 0;
>       return;
> fail:
>       cleanup_request(c);
>
>

Reply via email to