Blame SOURCES/0270-RHBZ-1775481-segfault-fix.patch

cdd025
---
cdd025
 kpartx/devmapper.c       |    3 ++-
cdd025
 libmultipath/devmapper.c |    7 ++++++-
cdd025
 2 files changed, 8 insertions(+), 2 deletions(-)
cdd025
cdd025
Index: multipath-tools-130222/kpartx/devmapper.c
cdd025
===================================================================
cdd025
--- multipath-tools-130222.orig/kpartx/devmapper.c
cdd025
+++ multipath-tools-130222/kpartx/devmapper.c
cdd025
@@ -330,7 +330,8 @@ dm_get_map(int major, int minor, char *
cdd025
 	next = dm_get_next_target(dmt, next, &start, &length,
cdd025
 				  &target_type, &params);
cdd025
 
cdd025
-	if (snprintf(outparams, PARAMS_SIZE, "%s", params) <= PARAMS_SIZE)
cdd025
+	if (params &&
cdd025
+	    snprintf(outparams, PARAMS_SIZE, "%s", params) <= PARAMS_SIZE)
cdd025
 		r = 0;
cdd025
 out:
cdd025
 	dm_task_destroy(dmt);
cdd025
Index: multipath-tools-130222/libmultipath/devmapper.c
cdd025
===================================================================
cdd025
--- multipath-tools-130222.orig/libmultipath/devmapper.c
cdd025
+++ multipath-tools-130222/libmultipath/devmapper.c
cdd025
@@ -461,6 +461,8 @@ dm_get_map(const char * name, unsigned l
cdd025
 	/* Fetch 1st target */
cdd025
 	next = dm_get_next_target(dmt, next, &start, &length,
cdd025
 				  &target_type, &params);
cdd025
+	if (!params)
cdd025
+		goto out;
cdd025
 
cdd025
 	if (size)
cdd025
 		*size = length;
cdd025
@@ -564,7 +566,8 @@ dm_get_status(char * name, char * outsta
cdd025
 	next = dm_get_next_target(dmt, next, &start, &length,
cdd025
 				  &target_type, &status);
cdd025
 
cdd025
-	if (snprintf(outstatus, PARAMS_SIZE, "%s", status) <= PARAMS_SIZE)
cdd025
+	if (status &&
cdd025
+	    snprintf(outstatus, PARAMS_SIZE, "%s", status) <= PARAMS_SIZE)
cdd025
 		r = 0;
cdd025
 out:
cdd025
 	if (r)
cdd025
@@ -1525,6 +1528,8 @@ int dm_reassign_table(const char *name,
cdd025
 	do {
cdd025
 		next = dm_get_next_target(dmt, next, &start, &length,
cdd025
 					  &target, &params);
cdd025
+		if (!params || !target)
cdd025
+			continue;
cdd025
 		memset(buff, 0, PARAMS_SIZE);
cdd025
 		strcpy(buff, params);
cdd025
 		if (strcmp(target, TGT_MPATH) && strstr(params, old)) {