mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: ensure string ends with \0
Use dm_strncpy() that ensures \0 termination.
This commit is contained in:
parent
835e8f9d7a
commit
bca6f58848
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user