]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: flower: Fix buffer overflow on large labels
authorPaul Blakey <paulb@nvidia.com>
Sun, 5 Dec 2021 13:20:25 +0000 (15:20 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 6 Dec 2021 21:44:50 +0000 (13:44 -0800)
Buffer is 64bytes, but label printing can take 66bytes printing
in hex, and will overflow when setting the string delimiter ('\0').

Fix that by increasing the print buffer size.

Example of overflowing ct_label:
ct_label 11111111111111111111111111111111/11111111111111111111111111111111

Fixes: 2fffb1c03056 ("tc: flower: Add matching on conntrack info")
Signed-off-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_flower.c

index 7f78195fd3034791a28b328ba7283644091de42b..6d70b92a2894c2363d1a0dafd6cda1fd203a66e5 100644 (file)
@@ -2195,7 +2195,7 @@ static void flower_print_ct_label(struct rtattr *attr,
        const unsigned char *str;
        bool print_mask = false;
        int data_len, i;
-       SPRINT_BUF(out);
+       char out[128];
        char *p;
 
        if (!attr)