Skip to contentSkip to conversation

multipathd: avoid crash in cli_list_path

PATCH In review Martin Wilck 2 participants 2 messages Jan 8, 2019 – Jan 17, 2019 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipathd: avoid crash in cli_list_path

multipathd can be crashed by passing an invalid path name to the "show path" command. Fix it.

---
 multipathd/cli_handlers.c | 2 ++
 1 file changed, 2 insertions(+)
multipathd/cli_handlers.c +2 -0
index 6304ed3a..fabf4440 100644
@@ -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");
 }
Signature · 1 line
2.19.2
maintainer Reviewed-by on v1 1/1
#1 lore raw

On Wed, Jan 09, 2019 at 12:25:43AM +0100, Martin Wilck wrote:

Quoted 21 lines

multipathd can be crashed by passing an invalid path name to the "show path" command. Fix it.

---
 multipathd/cli_handlers.c | 2 ++
 1 file changed, 2 insertions(+)
multipathd/cli_handlers.c +2 -0
index 6304ed3a..fabf4440 100644
@@ -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");
 }
Signature · 1 line
2.19.2