]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: channel: bo_getline() must wait for \n until buffer is full
authorWilly Tarreau <w@1wt.eu>
Tue, 10 Dec 2013 17:58:23 +0000 (18:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Dec 2013 17:58:23 +0000 (18:58 +0100)
We must not report incomplete data if the buffer is not full, otherwise
we can abort some processing on the stats socket when dealing with massive
amounts of commands.

src/channel.c

index 3e2a3f35f32314ef5029caa679b64f01af20ef14..2942d9241da5c42227d6073cc2de7e07bb097a7a 100644 (file)
@@ -230,7 +230,8 @@ int bo_getline(struct channel *chn, char *str, int len)
                        break;
                p = buffer_wrap_add(chn->buf, p + 1);
        }
-       if (ret > 0 && ret < len && ret < chn->buf->o &&
+       if (ret > 0 && ret < len &&
+           (ret < chn->buf->o || !channel_full(chn)) &&
            *(str-1) != '\n' &&
            !(chn->flags & (CF_SHUTW|CF_SHUTW_NOW)))
                ret = 0;