summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp/ltp/setregid01-security-string-formatting.patch
blob: 24449148f27e59522f10665a468f20c9efe62ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 430e05c2169ed15aaa6d7f9459edd607603cee02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
Date: Mon, 25 Feb 2019 10:44:33 -0600
Subject: [PATCH] setregid01: Fix security warning for string formatting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GCC 8.2.0 complains with the following:
  setregid01.c: In function 'run':
  setregid01.c:47:3: error: format not a string literal and no format arguments [-Werror=format-security]
     tst_res(TFAIL | TTERRNO, tc->msg);
     ^~~~~~~
because there is no string formatting in the message. This can
be seen with CFLAGS set to:
  -Wformat -Wformat-security -Werror=format-security
as Yocto Project's Poky does, e.g.:
  http://errors.yoctoproject.org/Errors/Details/230043/

Upstream-Status: Backport [46e1eda55f188810e6bf3a939b92d604321807ae]

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Enji Cooper <yaneurabeya@gmail.com>
---
 testcases/kernel/syscalls/setregid/setregid01.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/setregid/setregid01.c b/testcases/kernel/syscalls/setregid/setregid01.c
index f2e41e134..8c9e11918 100644
--- a/testcases/kernel/syscalls/setregid/setregid01.c
+++ b/testcases/kernel/syscalls/setregid/setregid01.c
@@ -44,9 +44,9 @@ static void run(unsigned int n)
 	TEST(SETREGID(*tc->arg1, *tc->arg2));
 
 	if (TST_RET == -1)
-		tst_res(TFAIL | TTERRNO, tc->msg);
+		tst_res(TFAIL | TTERRNO, "%s", tc->msg);
 	else
-		tst_res(TPASS, tc->msg);
+		tst_res(TPASS, "%s", tc->msg);
 }
 
 static void setup(void)
-- 
2.17.1