diff --git a/device_mapper/libdm-common.c b/device_mapper/libdm-common.c
index ef5d72e53..9856e6ebe 100644
--- a/device_mapper/libdm-common.c
+++ b/device_mapper/libdm-common.c
@@ -1451,8 +1451,8 @@ struct node_op_parms {
 
 static void _store_str(char **pos, char **ptr, const char *str)
 {
-	size_t len = strlen(str);
-	memcpy(*pos, str, len + 1);
+	size_t len = strlen(str) + 1;
+	memcpy(*pos, str, len);
 	*ptr = *pos;
 	*pos += len;
 }
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index ab080a911..48724b38f 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1449,8 +1449,8 @@ struct node_op_parms {
 
 static void _store_str(char **pos, char **ptr, const char *str)
 {
-	size_t len = strlen(str);
-	memcpy(*pos, str, len + 1);
+	size_t len = strlen(str) + 1;
+	memcpy(*pos, str, len);
 	*ptr = *pos;
 	*pos += len;
 }