mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-19 14:04:17 +03:00
Revert "lvmcache: check for too long pvid"
This reverts commit 70db1d523db330cbdfc39163c30dc00cf16a1fdc. Since we use 'strncpy' even for case where it exactly matches the buffer size and \0 is not expected to be added there.
This commit is contained in:
parent
b193809987
commit
28b4fa3e27
7
lib/cache/lvmcache.c
vendored
7
lib/cache/lvmcache.c
vendored
@ -1178,12 +1178,7 @@ static int _lvmcache_update_pvid(struct lvmcache_info *info, const char *pvid)
|
|||||||
return 1;
|
return 1;
|
||||||
if (*info->dev->pvid)
|
if (*info->dev->pvid)
|
||||||
dm_hash_remove(_pvid_hash, info->dev->pvid);
|
dm_hash_remove(_pvid_hash, info->dev->pvid);
|
||||||
|
strncpy(info->dev->pvid, pvid, sizeof(info->dev->pvid));
|
||||||
if (!dm_strncpy(info->dev->pvid, pvid, sizeof(info->dev->pvid))){
|
|
||||||
log_error("_lvmcache_update: too long pvid: %s.", pvid);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dm_hash_insert(_pvid_hash, pvid, info)) {
|
if (!dm_hash_insert(_pvid_hash, pvid, info)) {
|
||||||
log_error("_lvmcache_update: pvid insertion failed: %s", pvid);
|
log_error("_lvmcache_update: pvid insertion failed: %s", pvid);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -94,11 +94,9 @@ static int _text_write(struct label *label, void *buf)
|
|||||||
* PV header base
|
* PV header base
|
||||||
*/
|
*/
|
||||||
/* FIXME Move to where label is created */
|
/* FIXME Move to where label is created */
|
||||||
if (!dm_strncpy(label->type, LVM2_LABEL, sizeof(label->type)) ||
|
strncpy(label->type, LVM2_LABEL, sizeof(label->type));
|
||||||
!dm_strncpy((char *)lh->type, label->type, sizeof(label->type))) {
|
|
||||||
log_error(INTERNAL_ERROR "LVM2 label %s does not fit.", LVM2_LABEL);
|
strncpy((char *)lh->type, label->type, sizeof(label->type));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pvhdr = (struct pv_header *) ((char *) buf + xlate32(lh->offset_xl));
|
pvhdr = (struct pv_header *) ((char *) buf + xlate32(lh->offset_xl));
|
||||||
info = (struct lvmcache_info *) label->info;
|
info = (struct lvmcache_info *) label->info;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user