From 308c6f31c3d79b370b163660f3ec38042a00289f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 27 Jul 2021 15:12:56 +0200 Subject: [PATCH] pvck: ensure buffer is 0 terminated Since readed metadata buffer is passed to printf(), ensure the buffer is '\0' terminated. --- tools/pvck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pvck.c b/tools/pvck.c index d81966966..b15158746 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -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;