From 2f3fcbd245fe810fd9fd53fdcf24228768f5ac2a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 8 May 2024 09:54:30 +0200 Subject: [PATCH] libdm: fix invalid conversion Previous commit missed to also add one to added 'len'. --- device_mapper/libdm-common.c | 4 ++-- libdm/libdm-common.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; }