1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

pvck: ensure buffer is 0 terminated

Since readed metadata buffer is passed to printf(),
ensure the buffer is '\0' terminated.
This commit is contained in:
Zdenek Kabelac 2021-07-27 15:12:56 +02:00
parent 01081b2100
commit 308c6f31c3

View File

@ -898,7 +898,7 @@ static int _dump_current_text(struct device *dev, struct devicefile *def,
int ri = rlocn_index; /* 0 or 1 */
int bad = 0;
if (!(meta_buf = zalloc(meta_size))) {
if (!(meta_buf = zalloc(meta_size + 1))) {
log_print("CHECK: mda_header_%d.raw_locn[%d] no mem for metadata text size %llu", mn, ri,
(unsigned long long)meta_size);
return 0;