]> granicus.if.org Git - strace/commitdiff
aio: fix off-by-one error in indexed 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)
* aio.c (tprint_lio_opcode): Decrement xlat size by one to account
for XLAT_END as other users of indexed xlats do.

Fixes: v4.24~71 "aio: print IOCB_CMD_* using xlat"
aio.c

diff --git a/aio.c b/aio.c
index 4b3fde0ce16c1d9ffce42027bf0ff776a4f811d4..91a291cf42c1c01cc9e812c2def6c1b7d86b691d 100644 (file)
--- a/aio.c
+++ b/aio.c
@@ -50,7 +50,7 @@ tprint_lio_opcode(unsigned int cmd)
                [IOCB_CMD_PWRITEV]      = SUB_VECTOR,
        };
 
-       printxval_indexn_ex(ARRSZ_PAIR(aio_cmds), cmd, "IOCB_CMD_???",
+       printxval_indexn_ex(ARRSZ_PAIR(aio_cmds) - 1, cmd, "IOCB_CMD_???",
                            XLAT_STYLE_FMT_U);
 
        return cmd < ARRAY_SIZE(subs) ? subs[cmd] : SUB_NONE;