gfs2-utils/0007-mkfs.gfs2-Fix-strncpy-warnings.patch
2023-12-22 02:23:18 +08:00

37 lines
1.2 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 7cff23e49b7a80486e522fee5a645cd9b143c7c3 Mon Sep 17 00:00:00 2001
From: Andrew Price <anprice@redhat.com>
Date: Sat, 23 May 2020 15:05:43 +0100
Subject: [PATCH] mkfs.gfs2: Fix strncpy warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
New in gcc 10
warning: __builtin_strncpy specified bound 64 equals destination size
[-Wstringop-truncation]
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/mkfs/main_mkfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index bb8762b0..36fd08e7 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -1144,8 +1144,8 @@ int main(int argc, char *argv[])
build_root(&sbd);
sb.sb_root_dir = sbd.md.rooti->i_di.di_num;
- strncpy(sb.sb_lockproto, opts.lockproto, GFS2_LOCKNAME_LEN);
- strncpy(sb.sb_locktable, opts.locktable, GFS2_LOCKNAME_LEN);
+ strncpy(sb.sb_lockproto, opts.lockproto, GFS2_LOCKNAME_LEN - 1);
+ strncpy(sb.sb_locktable, opts.locktable, GFS2_LOCKNAME_LEN - 1);
sb.sb_lockproto[GFS2_LOCKNAME_LEN - 1] = '\0';
sb.sb_locktable[GFS2_LOCKNAME_LEN - 1] = '\0';
--
2.33.0