]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: applet: Disable 0-copy for buffers of different size
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Feb 2026 06:56:02 +0000 (07:56 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 18 Feb 2026 12:26:21 +0000 (13:26 +0100)
Just like the previous commit, we must take care to never swap buffers of
different size when data are exchanged between an applet and a SC. it will
be mandatory when the large buffers support on channels will be added.

src/applet.c

index 0e4ecf69d5dd4ae4fdb5118e989ce8257efe5afc..7b08539a39c5f68f698402202183015246f516cb 100644 (file)
@@ -505,7 +505,7 @@ size_t appctx_htx_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t coun
 
        ret = appctx_htx->data;
        buf_htx = htx_from_buf(buf);
-       if (htx_is_empty(buf_htx) && htx_used_space(appctx_htx) <= count) {
+       if (b_size(&appctx->outbuf) == b_size(buf) && htx_is_empty(buf_htx) && htx_used_space(appctx_htx) <= count) {
                htx_to_buf(buf_htx, buf);
                htx_to_buf(appctx_htx, &appctx->outbuf);
                b_xfer(buf, &appctx->outbuf, b_data(&appctx->outbuf));