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
|
From 7ba518ff8b5e5c06d0a74b1fecf3b682f14c631c Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 14 Feb 2016 18:07:46 -0500
Subject: [PATCH] report: avoid -Wformat-security warnings
Some functions warn when you pass a string to a printf style function
that is a dynamic buffer as its contents cannot be verified. Since we
don't want to support that here, just use %s.
---
src/lib/report-lib.c | 2 +-
src/prog/mouse-test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/report-lib.c b/src/lib/report-lib.c
index b565b77..03230b4 100644
--- a/src/lib/report-lib.c
+++ b/src/lib/report-lib.c
@@ -47,7 +47,7 @@ void gpm_report(int line, const char *file, int stat, const char *text, ... )
log_level = LOG_CRIT; break;
}
#ifdef HAVE_VSYSLOG
- syslog(log_level, string);
+ syslog(log_level, "%s", string);
vsyslog(log_level, text, ap);
#else
fprintf(stderr,"%s[%s(%d)]:\n",string,file,line);
diff --git a/src/prog/mouse-test.c b/src/prog/mouse-test.c
index ab8d602..d7d1027 100644
--- a/src/prog/mouse-test.c
+++ b/src/prog/mouse-test.c
@@ -189,7 +189,7 @@ int mousereopen(int oldfd, const char *name, Gpm_Type *type)
close(oldfd);
usleep(100000);
fd=open(name,O_RDWR);
- if (fd < 0) gpm_report(GPM_PR_OOPS,name);
+ if (fd < 0) gpm_report(GPM_PR_OOPS, "%s", name);
(*I_serial)(fd,type->flags,type,1,&type->name); /* ms initialization */
return fd;
}
|