]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
tc: m_gate: use SPRINT_BUF when needed
authorAndrea Claudi <aclaudi@redhat.com>
Mon, 22 Feb 2021 20:22:47 +0000 (21:22 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 23 Feb 2021 02:11:03 +0000 (18:11 -0800)
sprint_time64() uses SPRINT_BSIZE-1 as a constant buffer lenght in its
implementation, however m_gate uses shorter buffers when calling it.

Fix this using SPRINT_BUF macro to get the buffer, thus getting a
SPRINT_BSIZE-long buffer.

Fixes: 07d5ee70b5b3 ("iproute2-next:tc:action: add a gate control action")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/m_gate.c

index 892775a35e280c991084c0a990c4f624cf5c9ca4..c091ae19c1cc101afacb510cf0026713020c2c30 100644 (file)
@@ -427,7 +427,7 @@ static int print_gate_list(struct rtattr *list)
                __u32 index = 0, interval = 0;
                __u8 gate_state = 0;
                __s32 ipv = -1, maxoctets = -1;
-               char buf[22];
+               SPRINT_BUF(buf);
 
                parse_rtattr_nested(tb, TCA_GATE_ENTRY_MAX, item);
 
@@ -490,7 +490,7 @@ static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg)
        __s64 base_time = 0;
        __s64 cycle_time = 0;
        __s64 cycle_time_ext = 0;
-       char buf[22];
+       SPRINT_BUF(buf);
        int prio = -1;
 
        if (arg == NULL)