multipathd: avoid crash in cli_list_path
authorMartin Wilck <mwilck@suse.com>
Tue, 8 Jan 2019 23:25:43 +0000 (00:25 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sat, 19 Jan 2019 10:40:21 +0000 (11:40 +0100)
multipathd can be crashed by passing an invalid path name
to the "show path" command. Fix it.

multipathd/cli_handlers.c

index 14aec17..f9e9d69 100644 (file)
@@ -346,6 +346,8 @@ cli_list_path (void * v, char ** reply, int * len, void * data)
        condlog(3, "%s: list path (operator)", param);
 
        pp = find_path_by_dev(vecs->pathvec, param);
+       if (!pp)
+               return 1;
 
        return show_path(reply, len, vecs, pp, "%o");
 }