]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: lua/socket: Buffer error, may segfault
authorThierry FOURNIER <thierry.fournier@ozon.io>
Sat, 26 May 2018 23:14:47 +0000 (01:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 May 2018 08:58:41 +0000 (10:58 +0200)
The buffer pointer is already updated. It is again updated
when it is given to the function ci_putblk().

This patch must be backported in 1.6, 1.7 and 1.8

src/hlua.c

index 0144c3d65ff57eb36e37f5faa0eda9fafa6e656b..2f7fe99605a0027df83858075271076789d35fc6 100644 (file)
@@ -1974,7 +1974,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
        /* send data */
        if (len < send_len)
                send_len = len;
-       len = ci_putblk(&s->req, buf+sent, send_len);
+       len = ci_putblk(&s->req, buf, send_len);
 
        /* "Not enough space" (-1), "Buffer too little to contain
         * the data" (-2) are not expected because the available length