|
|
50e7afc |
From ad7eedc7eb9051443548392884d8c349341fe2f1 Mon Sep 17 00:00:00 2001
|
|
|
50e7afc |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
50e7afc |
Date: Tue, 3 Dec 2013 10:01:55 +0100
|
|
|
50e7afc |
Subject: [PATCH] Inhibit compiler warning on sscanf() without arguments
|
|
|
50e7afc |
MIME-Version: 1.0
|
|
|
50e7afc |
Content-Type: text/plain; charset=UTF-8
|
|
|
50e7afc |
Content-Transfer-Encoding: 8bit
|
|
|
50e7afc |
|
|
|
50e7afc |
This code will not pass if GCC is invoked with
|
|
|
50e7afc |
-Werror=format-security. This is a false positive as the format string
|
|
|
50e7afc |
is sanitized before.
|
|
|
50e7afc |
|
|
|
50e7afc |
<https://bugzilla.redhat.com/show_bug.cgi?id=1037250>
|
|
|
50e7afc |
|
|
|
50e7afc |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
50e7afc |
---
|
|
|
50e7afc |
src/ker/goodies.c | 6 +++++-
|
|
|
50e7afc |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
50e7afc |
|
|
|
50e7afc |
diff --git a/src/ker/goodies.c b/src/ker/goodies.c
|
|
|
50e7afc |
index 153a685..039858a 100644
|
|
|
50e7afc |
--- a/src/ker/goodies.c
|
|
|
50e7afc |
+++ b/src/ker/goodies.c
|
|
|
50e7afc |
@@ -845,7 +845,11 @@ scanstr(char *str, char *fmt, Any *r)
|
|
|
50e7afc |
ar = vsscanf(str, fmt, (va_list) ptrs);
|
|
|
50e7afc |
#else
|
|
|
50e7afc |
switch(argn)
|
|
|
50e7afc |
- { case 0: ar = sscanf(str, fmt); break;
|
|
|
50e7afc |
+ {
|
|
|
50e7afc |
+#pragma GCC diagnostic push
|
|
|
50e7afc |
+#pragma GCC diagnostic ignored "-Wformat-security"
|
|
|
50e7afc |
+ case 0: ar = sscanf(str, fmt); break;
|
|
|
50e7afc |
+#pragma GCC diagnostic pop
|
|
|
50e7afc |
case 1: ar = sscanf(str, fmt, ptrs[0]); break;
|
|
|
50e7afc |
case 2: ar = sscanf(str, fmt, ptrs[0], ptrs[1]); break;
|
|
|
50e7afc |
case 3: ar = sscanf(str, fmt, ptrs[0], ptrs[1], ptrs[2]);
|
|
|
50e7afc |
--
|
|
|
50e7afc |
1.8.3.1
|
|
|
50e7afc |
|