net/tcp: fix possible out-of-bounds reads in tcp_hash_fail()
[sfrench/cifs-2.6.git] / include / net / tcp_ao.h
index a375a171ef3cb37ab1d8246c72c6a3e83f5c9184..b56be10838f09a2cb56ab511242d2b583eb4c33b 100644 (file)
@@ -124,7 +124,7 @@ struct tcp_ao_info {
 #define tcp_hash_fail(msg, family, skb, fmt, ...)                      \
 do {                                                                   \
        const struct tcphdr *th = tcp_hdr(skb);                         \
-       char hdr_flags[5] = {};                                         \
+       char hdr_flags[6];                                              \
        char *f = hdr_flags;                                            \
                                                                        \
        if (th->fin)                                                    \
@@ -133,17 +133,18 @@ do {                                                                      \
                *f++ = 'S';                                             \
        if (th->rst)                                                    \
                *f++ = 'R';                                             \
+       if (th->psh)                                                    \
+               *f++ = 'P';                                             \
        if (th->ack)                                                    \
-               *f++ = 'A';                                             \
-       if (f != hdr_flags)                                             \
-               *f = ' ';                                               \
+               *f++ = '.';                                             \
+       *f = 0;                                                         \
        if ((family) == AF_INET) {                                      \
-               net_info_ratelimited("%s for (%pI4, %d)->(%pI4, %d) %s" fmt "\n", \
+               net_info_ratelimited("%s for %pI4.%d->%pI4.%d [%s] " fmt "\n", \
                                msg, &ip_hdr(skb)->saddr, ntohs(th->source), \
                                &ip_hdr(skb)->daddr, ntohs(th->dest),   \
                                hdr_flags, ##__VA_ARGS__);              \
        } else {                                                        \
-               net_info_ratelimited("%s for [%pI6c]:%u->[%pI6c]:%u %s" fmt "\n", \
+               net_info_ratelimited("%s for [%pI6c].%d->[%pI6c].%d [%s]" fmt "\n", \
                                msg, &ipv6_hdr(skb)->saddr, ntohs(th->source), \
                                &ipv6_hdr(skb)->daddr, ntohs(th->dest), \
                                hdr_flags, ##__VA_ARGS__);              \