]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h1: Don't parse chunks CRLF if not enough data are available
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Apr 2019 12:12:27 +0000 (14:12 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Apr 2019 13:53:23 +0000 (15:53 +0200)
As specified in the function comment, the function h1_skip_chunk_crlf() must not
change anything and return zero if not enough data are available. This must
include the case where there is no data at all. On this point, it must do the
same that other h1 parsing functions. This bug is made visible since the commit
91f77d599 ("BUG/MINOR: mux-h1: Process input even if the input buffer is
empty").

This patch must be backported to 1.9.

include/common/h1.h

index b36f6fa041226b7f281889785e4c7c336736aa7e..0d652e7bbb79cd439de216b9bd48da02ca56480f 100644 (file)
@@ -202,6 +202,9 @@ static inline int h1_skip_chunk_crlf(const struct buffer *buf, int start, int st
        const char *ptr = b_peek(buf, start);
        int bytes = 1;
 
+       if (stop <= start)
+               return 0;
+
        /* NB: we'll check data availability at the end. It's not a
         * problem because whatever we match first will be checked
         * against the correct length.