From patchwork Thu Jul 6 13:35:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 785175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x3Jdl2yrJz9s7B for ; Thu, 6 Jul 2017 23:35:23 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3x3Jdl26WPzDr4M for ; Thu, 6 Jul 2017 23:35:23 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3x3Jdh37ZGzDr3x for ; Thu, 6 Jul 2017 23:35:20 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C26506540; Thu, 6 Jul 2017 13:35:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C26506540 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C26506540 Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 343F45F925; Thu, 6 Jul 2017 13:35:10 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Thu, 6 Jul 2017 15:35:09 +0200 Message-Id: <1499348109-8835-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 06 Jul 2017 13:35:17 +0000 (UTC) Subject: [SLOF] [PATCH] libnet: Make the code compilable with -Wformat-security X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" When compiling the libnet code with the -Wformat-security compiler flag, there is a warning in tftp.c that printf is used without format argument. It's not a real problem here, but let's make the code ready for this compiler flag anyway and add a proper format string here, too. Signed-off-by: Thomas Huth Reviewed-by: Nikunj A Dadhania --- lib/libnet/tftp.c | 2 +- make.rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libnet/tftp.c b/lib/libnet/tftp.c index ab63578..108092b 100644 --- a/lib/libnet/tftp.c +++ b/lib/libnet/tftp.c @@ -266,7 +266,7 @@ static void print_progress(int urgent, int received_bytes) sprintf(buffer, "%d KBytes", (progress_last_bytes >> 10)); for(ptr = buffer; *ptr != 0; ++ptr) *ptr = '\b'; - printf(buffer); + printf("%s", buffer); } printf("%d KBytes", (received_bytes >> 10)); i = 1; diff --git a/make.rules b/make.rules index cbc6353..3067314 100644 --- a/make.rules +++ b/make.rules @@ -72,7 +72,7 @@ AR ?= $(CROSS)ar RANLIB ?= $(CROSS)ranlib CPP ?= $(CROSS)cpp -WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes +WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -Wformat-security CFLAGS ?= -g -O2 -fno-builtin -ffreestanding -nostdinc -msoft-float -fno-strict-aliasing \ -mno-altivec -mabi=no-altivec -fno-stack-protector $(WARNFLAGS)