From patchwork Mon Jan 12 16:08:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 17967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C954FDE18A for ; Tue, 13 Jan 2009 03:10:29 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LMPKn-00089Z-QO; Mon, 12 Jan 2009 16:08:13 +0000 Received: from smtp.gentoo.org ([140.211.166.183]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1LMPKj-00089K-0d for linux-mtd@lists.infradead.org; Mon, 12 Jan 2009 16:08:11 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id AAA5064DCC for ; Mon, 12 Jan 2009 16:08:07 +0000 (UTC) From: Mike Frysinger To: linux-mtd@lists.infradead.org Subject: [PATCH] ubi-utils: fix warning in fprintf() code Date: Mon, 12 Jan 2009 11:08:07 -0500 Message-Id: <1231776487-21240-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.6.1 X-Spam-Score: 0.0 (/) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When building with gcc security warnings enabled, the ubimirror.c code triggers this warning: ./src/ubimirror.c: In function 'main': ./src/ubimirror.c:206: error: format not a string literal and no format arguments Since the buffer in question should be a straight string anyways, avoid ugly printf exploits by outputting the string indirectly: printf("%s", buffer) Signed-off-by: Mike Frysinger --- ubi-utils/src/ubimirror.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ubi-utils/src/ubimirror.c b/ubi-utils/src/ubimirror.c index 2cc4596..a20e1af 100644 --- a/ubi-utils/src/ubimirror.c +++ b/ubi-utils/src/ubimirror.c @@ -203,7 +203,7 @@ main(int argc, char **argv) { err_buf, sizeof(err_buf)); if( rc ){ err_buf[sizeof err_buf - 1] = '\0'; - fprintf(stderr, err_buf); + fprintf(stderr, "%s", err_buf); if( rc < 0 ) rc = -rc; }