From 105cb1e4cfed2f7a92946fe7e9efc442e0183714 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Fri, 15 Apr 2022 14:23:41 +0000 Subject: api: fix infinite loop in show api dump CLI The following illustrates the problem: ./build-root/install-vpp_debug-native/vpp/bin/vpp api-trace { on } unix { cli-listen /tmp/vpp-api-cli.sock } plugins { plugin dpdk_plugin.so { disable } } sleep 5 ./build-root/install-vpp_debug-native/vpp/bin/vppctl -s /tmp/vpp-api-cli.sock show version ./build-root/install-vpp_debug-native/vpp/bin/vppctl -s /tmp/vpp-api-cli.sock show api dump file /tmp/api-table.master-api-baseline compare The last CLI hangs in an infinite loop. Fix the typo which got in during the conversion of _vec_len to read-only: .@@ -1285,7 +1285,7 @@ extract_name (u8 * s) . rv = vec_dup (s); . . while (vec_len (rv) && rv[vec_len (rv)] != '_') .- _vec_len (rv)--; .+ vec_dec_len (rv, 0); . Type: fix Fixes: 8bea589cfe0fca1a6f560e16ca66a4cf199041a2 Signed-off-by: Andrew Yourtchenko Change-Id: I4f895348ae0ebaaba9da97c3a440912d38210f10 --- src/vlibmemory/vlib_api_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vlibmemory') diff --git a/src/vlibmemory/vlib_api_cli.c b/src/vlibmemory/vlib_api_cli.c index bdbedec009b..39e22507c1b 100644 --- a/src/vlibmemory/vlib_api_cli.c +++ b/src/vlibmemory/vlib_api_cli.c @@ -1285,7 +1285,7 @@ extract_name (u8 * s) rv = vec_dup (s); while (vec_len (rv) && rv[vec_len (rv)] != '_') - vec_dec_len (rv, 0); + vec_dec_len (rv, 1); rv[vec_len (rv)] = 0; -- cgit 1.2.3-korg