]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: spop-conn: Report short read for partial frames payload
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 May 2025 07:20:08 +0000 (09:20 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 May 2025 07:20:10 +0000 (09:20 +0200)
When a frame was not fully received, a short read must be reported on the
SPOP connection to help the demux to handle truncated frames. This was
performed for frames truncated on the header part but not on the payload
part. It is now properly detected.

This patch must be backported to 3.1.

src/mux_spop.c

index b79849c1180fd91946a7b9db4685145bf874ca0f..2a5002d99dd1b2862bb5bcd9a7cdb15a431b9e37 100644 (file)
@@ -1643,6 +1643,7 @@ static int spop_conn_handle_hello(struct spop_conn *spop_conn)
 
        /* process full record only */
        if (b_data(dbuf) < (spop_conn->dfl)) {
+               spop_conn->flags |= SPOP_CF_DEM_SHORT_READ;
                TRACE_DEVEL("leaving on missing data", SPOP_EV_RX_FRAME|SPOP_EV_RX_HELLO, spop_conn->conn);
                return 0;
        }
@@ -1814,6 +1815,7 @@ static int spop_conn_handle_disconnect(struct spop_conn *spop_conn)
 
        /* process full record only */
        if (b_data(dbuf) < (spop_conn->dfl)) {
+               spop_conn->flags |= SPOP_CF_DEM_SHORT_READ;
                TRACE_DEVEL("leaving on missing data", SPOP_EV_RX_FRAME|SPOP_EV_RX_DISCO, spop_conn->conn);
                return 0;
        }
@@ -1925,6 +1927,7 @@ static int spop_conn_handle_ack(struct spop_conn *spop_conn, struct spop_strm *s
 
        /* process full record only */
        if (b_data(dbuf) < (spop_conn->dfl)) {
+               spop_conn->flags |= SPOP_CF_DEM_SHORT_READ;
                TRACE_DEVEL("leaving on missing data", SPOP_EV_RX_FRAME|SPOP_EV_RX_DISCO, spop_conn->conn);
                return 0;
        }