]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: spoa-example: unexpected behavior for more than 127 args
authorThierry FOURNIER <thierry.fournier@ozon.io>
Sun, 25 Feb 2018 20:33:38 +0000 (21:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Mar 2018 11:59:10 +0000 (12:59 +0100)
Buf is unsigned, so nbargs will be negative for more then 127 args.

Note that I cant test this bug because I cant put sufficient args
on the configuration line. It is just detected reading code.

[wt: this can be backported to 1.8 & 1.7]

contrib/spoa_example/spoa.c

index 026f25680f8660c6b58fe651e7d423b1d63c6b12..bf2dbe9a9d2b5819e4653f9007c24a6ddc267c30 100644 (file)
@@ -1318,7 +1318,7 @@ process_frame_cb(evutil_socket_t fd, short events, void *arg)
 
                DEBUG(frame->worker, "Process SPOE Message '%.*s'", (int)sz, str);
 
-               nbargs = *p++;                     /* Get the number of arguments */
+               nbargs = (unsigned char)*p++;      /* Get the number of arguments */
                frame->offset = (p - frame->buf);  /* Save index to handle errors and skip args */
                if (!memcmp(str, "check-client-ip", sz)) {
                        union spoe_data data;