[dm-devel] [PATCH 10/39] libmultipath/alias.c: check return value from strchr()
Hannes Reinecke
hare at suse.de
Thu Jun 16 09:47:16 UTC 2016
Found by coverity.
Signed-off-by: Hannes Reinecke <hare at suse.com>
---
libmultipath/alias.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/alias.c b/libmultipath/alias.c
index 5fdcdb5..b86843a 100644
--- a/libmultipath/alias.c
+++ b/libmultipath/alias.c
@@ -229,7 +229,8 @@ allocate_binding(int fd, char *wwid, int id, char *prefix)
return NULL;
}
c = strchr(buf, ' ');
- *c = '\0';
+ if (c)
+ *c = '\0';
alias = strdup(buf);
if (alias == NULL)
condlog(0, "cannot copy new alias from bindings file : %s",
--
2.6.6
More information about the dm-devel
mailing list