From 476b03b33a9e4d0eb1a77fcb544c58b34d0e27b9 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 23 Dec 2018 22:12:36 +0000 Subject: [PATCH] net: fix off-by-one error in sorted xlat lookup * 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net.c b/net.c index bcab3294..a87bdf74 100644 --- 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: -- 2.50.1