[lvm-devel] master - cov: check dm_strncpy result

Zdenek Kabelac zkabelac at sourceware.org
Mon Oct 15 15:55:45 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=668c9d0762fc6736a1e9372785544eda6a939806
Commit:        668c9d0762fc6736a1e9372785544eda6a939806
Parent:        b1ff52ca146f58938c07f6c6855bc860453059e6
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Mon Oct 15 16:16:14 2018 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Oct 15 17:49:44 2018 +0200

cov: check dm_strncpy result

---
 device_mapper/vdo/status.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/device_mapper/vdo/status.c b/device_mapper/vdo/status.c
index c86c911..6ae7b84 100644
--- a/device_mapper/vdo/status.c
+++ b/device_mapper/vdo/status.c
@@ -207,7 +207,11 @@ bool dm_vdo_status_parse(struct dm_pool *mem, const char *input,
 		_set_error(result, "out of memory");
 		goto bad;
 	}
-	dm_strncpy(s->device, b, te - b + 1);
+
+	if (!dm_strncpy(s->device, b, te - b + 1)) {
+		_set_error(result, "copy device");
+		goto bad;
+	}
 
 	b = _eat_space(te, e);
 




More information about the lvm-devel mailing list