From patchwork Sat Jul 13 23:14:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Borowski X-Patchwork-Id: 11043145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D06AB6C5 for ; Sat, 13 Jul 2019 23:15:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E4E27E01 for ; Sat, 13 Jul 2019 23:15:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5BF52811A; Sat, 13 Jul 2019 23:15:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD12927E01 for ; Sat, 13 Jul 2019 23:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728761AbfGMXPD (ORCPT ); Sat, 13 Jul 2019 19:15:03 -0400 Received: from tartarus.angband.pl ([54.37.238.230]:53454 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728733AbfGMXPC (ORCPT ); Sat, 13 Jul 2019 19:15:02 -0400 Received: from [2a02:a31c:853f:a300::4] (helo=valinor.angband.pl) by tartarus.angband.pl with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hmREH-0000VH-RN; Sun, 14 Jul 2019 01:14:59 +0200 Received: from kilobyte by valinor.angband.pl with local (Exim 4.92) (envelope-from ) id 1hmREH-000Bke-CP; Sun, 14 Jul 2019 01:14:57 +0200 From: Adam Borowski To: David Sterba , linux-btrfs@vger.kernel.org Cc: Adam Borowski Date: Sun, 14 Jul 2019 01:14:54 +0200 Message-Id: <20190713231454.45129-1-kilobyte@angband.pl> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a02:a31c:853f:a300::4 X-SA-Exim-Mail-From: kilobyte@angband.pl Subject: [PATCH] btrfs-progs: fix a printf format string fatal warning X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on tartarus.angband.pl) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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('-'); }