From: Adam Borowski <kilobyte@angband.pl>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Cc: Adam Borowski <kilobyte@angband.pl>
Subject: [PATCH] btrfs-progs: fix a printf format string fatal warning
Date: Sun, 14 Jul 2019 01:14:54 +0200 [thread overview]
Message-ID: <20190713231454.45129-1-kilobyte@angband.pl> (raw)
At least in Debian, default build flags include -Werror=format-security,
for good reasons in most cases. Here, the string comes from strftime --
and though I don't suspect any locale would be crazy enough to have %X
include a '%' char, the compiler has no way to know that.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
common/format-output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/format-output.c b/common/format-output.c
index c5f1b51f..98fb8607 100644
--- a/common/format-output.c
+++ b/common/format-output.c
@@ -280,7 +280,7 @@ void fmt_print(struct format_ctx *fctx, const char* key, ...)
localtime_r(&ts, &tm);
strftime(tstr, 256, "%Y-%m-%d %X %z", &tm);
- printf(tstr);
+ printf("%s", tstr);
} else {
putchar('-');
}
--
2.22.0
next reply other threads:[~2019-07-13 23:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-13 23:14 Adam Borowski [this message]
2019-07-22 12:44 ` [PATCH] btrfs-progs: fix a printf format string fatal warning David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190713231454.45129-1-kilobyte@angband.pl \
--to=kilobyte@angband.pl \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).