]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
expprint: Fix format string warning
authorSimon Marchi <simon.marchi@ericsson.com>
Tue, 5 Sep 2017 07:00:42 +0000 (09:00 +0200)
committerSimon Marchi <simon.marchi@ericsson.com>
Tue, 5 Sep 2017 07:01:13 +0000 (09:01 +0200)
My compiler (gcc 5.4.0, clang 3.8) gives this warning:

/home/emaisin/src/binutils-gdb/gdb/expprint.c: In lambda function:
/home/emaisin/src/binutils-gdb/gdb/expprint.c:1055:35: error: format not a string literal and no format arguments [-Werror=format-security]
      fprintf_filtered (stream, mod);
                                   ^

Fix it by not using the passed string as the format string.

gdb/ChangeLog:

* expprint.c (dump_subexp_body_standard): Use constant format
string in fprintf_filtered call.

gdb/ChangeLog
gdb/expprint.c

index de1945aec933a1f5f9c75d1e014e97cdde3b029e..19882f04475d1082845920106a4a86260e571b90 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-05  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * expprint.c (dump_subexp_body_standard): Use constant format
+       string in fprintf_filtered call.
+
 2017-09-04  John Baldwin  <jhb@FreeBSD.org>
 
        * configure.nat: Add "x86-nat.o x86-dregs.o" for NetBSD/amd64 and
index 2c16b497fc06c1b8f2be04979e95b81fca7a2f7a..9e04f247b6532ead27496522840f358686a890fa 100644 (file)
@@ -1052,7 +1052,7 @@ dump_subexp_body_standard (struct expression *exp,
            if (space)
              fputs_filtered (" ", stream);
            space = true;
-           fprintf_filtered (stream, mod);
+           fprintf_filtered (stream, "%s", mod);
          };
        if (flags & TYPE_INSTANCE_FLAG_CONST)
          print_one ("const");