From 690ca8207269919e89341a9a49a3cff0e56e344b Mon Sep 17 00:00:00 2001 From: ShyamsundarR Date: Mon, 20 Aug 2018 16:01:47 -0400 Subject: cli: Fix invalid access of option_str variable In function cli_cmd_volume_statedump_options_parse if the wordcount of arguments is exactly 3, then option_str would remain NULL, and hence the function will generate a segmentation fault on the strstr check in its body. This can be triggered when we run the command, `gluster volume statedump ` The fix is to check if option_str is non-NULL before use and also to pass in a duplicated empty string to the dict key "options" when this is NULL. Fixes: bz#1619423 Change-Id: Ic029ab60b64890d92c7a0876a638929495d3aa59 Signed-off-by: ShyamsundarR --- tests/bugs/cli/bug-1169302.t | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/bugs/cli/bug-1169302.t b/tests/bugs/cli/bug-1169302.t index 0bdaf56307e..19660e033a8 100755 --- a/tests/bugs/cli/bug-1169302.t +++ b/tests/bugs/cli/bug-1169302.t @@ -20,6 +20,9 @@ TEST $CLI_1 volume create $V0 $H1:$B1/$V0 $H2:$B2/$V0 $H3:$B3/$V0 TEST $CLI_1 volume start $V0 # test CLI parameter acceptance +TEST $CLI_1 volume statedump $V0 +TEST $CLI_2 volume statedump $V0 +TEST $CLI_3 volume statedump $V0 TEST ! $CLI_1 volume statedump $V0 client $H2:0 TEST ! $CLI_2 volume statedump $V0 client $H2:-1 TEST $CLI_3 volume statedump $V0 client $H2:765 -- cgit