]> granicus.if.org Git - strace/commitdiff
net: fix off-by-one error in sorted xlat lookup
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)
* net.c (ax25_protocols): Decrement xlat size by one to account
for XLAT_END as other users of sorted xlats do.

Fixes: v4.25~28 "net: add support for AX.25 protocols and socket option names decoding"
net.c

diff --git a/net.c b/net.c
index bcab329469a56bf2e931af3b864faae73149eb26..a87bdf74103126a31a9957d01f3ed8ae0e28784d 100644 (file)
--- a/net.c
+++ b/net.c
@@ -128,8 +128,9 @@ SYS_FUNC(socket)
 
        case AF_AX25:
                /* Those are not available in public headers.  */
-               printxval_searchn_ex(ARRSZ_PAIR(ax25_protocols), tcp->u_arg[2],
-                                    "AX25_P_???", XLAT_STYLE_VERBOSE);
+               printxval_searchn_ex(ARRSZ_PAIR(ax25_protocols) - 1,
+                                    tcp->u_arg[2], "AX25_P_???",
+                                    XLAT_STYLE_VERBOSE);
                break;
 
        case AF_NETLINK: