Skip to contentSkip to conversation

multipath-tools fixes

PATCH New Christof Schmitt 1 participant 3 messages Jul 22, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

cover multipath-tools fixes

Here are two fixes for the multipathd. The first one fixes a potential memory corruption; the second one fixes a segfault in the interactive client.

Christof

#1 lore raw

PATCH 1/2 multipath-tools: Assign correct pointer from REALLOC

From: Christof Schmitt <[email protected]>

Assign the pointer returned from REALLOC to v->slot; this is the memory area to be changed.

---
 libmultipath/vector.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/vector.c +1 -1
@@ -96,7 +96,7 @@ vector_del_slot(vector v, int slot)
 		v->slot = NULL;
 	}
 	else
-		v = REALLOC(v->slot, sizeof (void *) * v->allocated);
+		v->slot = REALLOC(v->slot, sizeof (void *) * v->allocated);
 }
 
 void
#2 lore raw

PATCH 2/2 multipath-tools: Intialize pointer passed to get_cmdvec

In reply to Christof Schmitt

From: Christof Schmitt <[email protected]>

get_cmdvec can return before the vector argument has been initialized. Fix this by initializing the pointer before passing it to get_cmdvec. This fixes a segfault in the interactive mode when hitting the tab key directly on the command prompt.

---
 multipathd/cli.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
multipathd/cli.c +2 -2
@@ -363,7 +363,7 @@ parse_cmd (char * cmd, char ** reply, in
 {
 	int r;
 	struct handler * h;
-	vector cmdvec;
+	vector cmdvec = NULL;
 
 	r = get_cmdvec(cmd, &cmdvec);
 
@@ -467,7 +467,7 @@ key_generator (const char * str, int sta
 	struct key * kw;
 	int i;
 	struct handler *h;
-	vector v;
+	vector v = NULL;
 
 	if (!state) {
 		index = 0;