From: Zdenek Kabelac Date: Wed, 8 May 2024 07:54:30 +0000 (+0200) Subject: libdm: fix invalid conversion X-Git-Tag: v2_03_24~63 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=refs%2Fpipelines%2F1282874709;p=lvm2.git libdm: fix invalid conversion Previous commit missed to also add one to added 'len'. --- 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; }