Blame libipt-pttc-lto-fix-lto-strlen-size-warning.patch

e37a453
From 0144bc2fa99421725585dbc7ecbe2e412f7f8d27 Mon Sep 17 00:00:00 2001
e37a453
From: Markus Metzger <markus.t.metzger@intel.com>
e37a453
Date: Thu, 12 Oct 2023 12:57:41 +0000
e37a453
Subject: [PATCH 1/2] pttc, lto: fix lto strnlen size warning
e37a453
MIME-Version: 1.0
e37a453
Content-Type: text/plain; charset=UTF-8
e37a453
Content-Transfer-Encoding: 8bit
e37a453
e37a453
Building with -flto results in
e37a453
e37a453
    .../pttc/src/util.c:48:15: error: ‘strnlen’ specified bound 4096 exceeds source size 1024 [-Werror=stringop-overread]
e37a453
       48 |         len = strnlen(s, n);
e37a453
          |               ^
e37a453
    .../pttc/src/util.c: In function ‘yasm_advance_next_line.part.0’:
e37a453
    .../pttc/src/yasm.c:790:14: note: source object declared here
e37a453
      790 |         char s[1024];
e37a453
          |              ^
e37a453
e37a453
Increase the size to fix this.
e37a453
e37a453
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
e37a453
---
e37a453
 pttc/src/yasm.c | 2 +-
e37a453
 1 file changed, 1 insertion(+), 1 deletion(-)
e37a453
e37a453
diff --git a/pttc/src/yasm.c b/pttc/src/yasm.c
e37a453
index 33b8eb9..1004cfa 100644
e37a453
--- a/pttc/src/yasm.c
e37a453
+++ b/pttc/src/yasm.c
e37a453
@@ -787,7 +787,7 @@ int yasm_lookup_label(const struct yasm *y, uint64_t *addr,
e37a453
 
e37a453
 static int yasm_advance_next_line(struct yasm *y)
e37a453
 {
e37a453
-	char s[1024];
e37a453
+	char s[FILENAME_MAX+1];
e37a453
 	char filename[FILENAME_MAX+1];
e37a453
 	int errcode;
e37a453
 	int asm_line, asm_inc;
e37a453
-- 
e37a453
2.41.0
e37a453