summaryrefslogtreecommitdiff
path: root/lib/format_text/text_label.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-08-18 11:28:02 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-08-18 14:53:36 +0200
commit70db1d523db330cbdfc39163c30dc00cf16a1fdc (patch)
tree145358c1877cb21091a51a24cb581362298d0bee /lib/format_text/text_label.c
parent8e229cb7ea37ccab0e235e53d27adca9b32ffae0 (diff)
downloadlvm2-70db1d523db330cbdfc39163c30dc00cf16a1fdc.tar.gz
lvmcache: check for too long pvid
Diffstat (limited to 'lib/format_text/text_label.c')
-rw-r--r--lib/format_text/text_label.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index 4ad2ccdb2..5835bc297 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -94,9 +94,11 @@ static int _text_write(struct label *label, void *buf)
* PV header base
*/
/* FIXME Move to where label is created */
- strncpy(label->type, LVM2_LABEL, sizeof(label->type));
-
- strncpy((char *)lh->type, label->type, sizeof(label->type));
+ if (!dm_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);
+ return 0;
+ }
pvhdr = (struct pv_header *) ((char *) buf + xlate32(lh->offset_xl));
info = (struct lvmcache_info *) label->info;