From c296e2921a616258fbf38018e14fd563084f0fbf Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2020 15:44:52 +0100 Subject: vty: Fix left shifting out of range on signed variable Fixes following ASan runtime errors while running vty tests: command.c:730:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Somehow we didn't catch this one in Ie11ff18d6fd9f6e1e91a51b6156fb6b0b7d3a9a8 Change-Id: I601caf7daa947f3cf391316f1011007ef9188c90 --- src/vty/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vty/command.c b/src/vty/command.c index b38be34e..4825109e 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -727,7 +727,7 @@ static int vty_dump_element(const struct cmd_element *cmd, print_func_t print_fu char flag; /* Skip attribute if *not* set */ - if (~cmd->usrattr & (1 << i)) + if (~cmd->usrattr & ((unsigned)1 << i)) continue; xml_att_desc = xml_escape(desc[i]); -- cgit v1.2.3