diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c index ed645cce3..9ba9ce000 100644 --- a/daemons/lvmlockd/lvmlockd-core.c +++ b/daemons/lvmlockd/lvmlockd-core.c @@ -5719,9 +5719,9 @@ static void adopt_locks(void) act->flags = (LD_AF_ADOPT | LD_AF_PERSISTENT); act->client_id = INTERNAL_CLIENT_ID; act->lm_type = ls->lm_type; - strncpy(act->vg_name, ls->vg_name, MAX_NAME); - strncpy(act->lv_uuid, r->name, MAX_NAME); - strncpy(act->lv_args, r->lv_args, MAX_ARGS); + (void)dm_strncpy(act->vg_name, ls->vg_name, MAX_NAME); + (void)dm_strncpy(act->lv_uuid, r->name, MAX_NAME); + (void)dm_strncpy(act->lv_args, r->lv_args, MAX_ARGS); log_debug("adopt lock for lv %s %s", act->vg_name, act->lv_uuid); diff --git a/lib/device/device_id.c b/lib/device/device_id.c index 62dc88b78..14f45c686 100644 --- a/lib/device/device_id.c +++ b/lib/device/device_id.c @@ -66,9 +66,9 @@ char devices_file_product_uuid_orig[PATH_MAX]; char *strdup_pvid(char *pvid) { char *buf; - if (!(buf = zalloc(ID_LEN + 1))) + if (!(buf = malloc(ID_LEN + 1))) return NULL; - strncpy(buf, pvid, ID_LEN); + (void)dm_strncpy(buf, pvid, ID_LEN + 1); return buf; } @@ -1235,7 +1235,7 @@ int device_ids_read(struct cmd_context *cmd) /* Save original for lvmdevices output. */ if (!strcmp(cmd->name, "lvmdevices")) - strncpy(devices_file_hostname_orig, check_id, PATH_MAX-1); + (void)dm_strncpy(devices_file_hostname_orig, check_id, PATH_MAX); if (!cmd->device_ids_check_hostname) continue; @@ -1255,7 +1255,7 @@ int device_ids_read(struct cmd_context *cmd) /* Save original for lvmdevices output. */ if (!strcmp(cmd->name, "lvmdevices")) - strncpy(devices_file_product_uuid_orig, check_id, PATH_MAX-1); + (void)dm_strncpy(devices_file_product_uuid_orig, check_id, PATH_MAX); if (!cmd->device_ids_check_product_uuid) continue; @@ -1482,7 +1482,7 @@ static void devices_file_backup(struct cmd_context *cmd, char *fc, char *fb, tim (de_date < low_date) || (de_date == low_date && de_time < low_time) || (de_date == low_date && de_time == low_time && de_count < low_count)) { - strncpy(low_name, de->d_name, sizeof(low_name)); + (void)dm_strncpy(low_name, de->d_name, sizeof(low_name)); low_date = de_date; low_time = de_time; low_count = de_count;