This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED PATCH] Fix -Wformat-security warnings in posix/regexbug1.c
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Thu, 11 Dec 2014 13:13:13 -0800 (PST)
- Subject: [COMMITTED PATCH] Fix -Wformat-security warnings in posix/regexbug1.c
- Authentication-results: sourceware.org; auth=none
2014-12-11 Roland McGrath <roland@hack.frob.com>
* posix/regexbug1.c (main): Use "%s" format with regerror results,
rather than assuming they won't contain any '%'s.
--- a/posix/regexbug1.c
+++ b/posix/regexbug1.c
@@ -18,7 +18,7 @@ main (void)
{
char buf[100];
regerror (reerr, &re, buf, sizeof buf);
- error (EXIT_FAILURE, 0, buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
if (regexec (&re, "002", 2, ma, 0) != 0)
@@ -35,7 +35,7 @@ main (void)
{
char buf[100];
regerror (reerr, &re, buf, sizeof buf);
- error (EXIT_FAILURE, 0, buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
if (regexec (&re, "002", 2, ma, 0) != 0)