From: Junling Zheng Subject: [PATCH] fsck.f2fs: do not print content beyond sb->version Date: Wed, 6 Jun 2018 22:39:24 +0800 Message-ID: <20180606143924.154725-1-zhengjunling@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fQZbM-0005by-1V for linux-f2fs-devel@lists.sourceforge.net; Wed, 06 Jun 2018 14:39:52 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1fQZbJ-009Cx5-UK for linux-f2fs-devel@lists.sourceforge.net; Wed, 06 Jun 2018 14:39:51 +0000 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: jaegeuk@kernel.org, yuchao0@huawei.com Cc: miaoxie@huawei.com, linux-f2fs-devel@lists.sourceforge.net Currently, versions in f2fs_configuration have one more byte than those in sb, so versions in sb may not end with '\0', and then print_raw_sb_info() will print something beyond sb->version. Signed-off-by: Junling Zheng --- fsck/mount.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fsck/mount.c b/fsck/mount.c index 0a30adb..9def919 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -341,7 +341,10 @@ void print_raw_sb_info(struct f2fs_super_block *sb) DISP_u32(sb, node_ino); DISP_u32(sb, meta_ino); DISP_u32(sb, cp_payload); - DISP("%s", sb, version); + if (sb->version[255] != '\0') + DISP("%-.256s", sb, version); + else + DISP("%s", sb, version); printf("\n"); } -- 2.17.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot