From patchwork Mon Feb 4 07:24:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Poornima, PallantlaX" X-Patchwork-Id: 50128 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E7FF1B12B; Mon, 4 Feb 2019 08:25:38 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 255021B129; Mon, 4 Feb 2019 08:25:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2019 23:25:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="316104357" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga006.fm.intel.com with ESMTP; 03 Feb 2019 23:25:34 -0800 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x147PXJr020143; Mon, 4 Feb 2019 07:25:33 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x147Owaq004951; Mon, 4 Feb 2019 07:24:58 GMT Received: (from ppoornix@localhost) by wgcvswdev001.ir.intel.com with ? id x147Ow6x004947; Mon, 4 Feb 2019 07:24:58 GMT From: Pallantla Poornima To: dev@dpdk.org Cc: reshma.pattan@intel.com, david.hunt@intel.com, Pallantla Poornima , stable@dpdk.org Date: Mon, 4 Feb 2019 07:24:56 +0000 Message-Id: <1549265096-4812-1-git-send-email-pallantlax.poornima@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-dev] [PATCH] power: fix sprintf with snprintf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" sprintf function is not secure as it doesn't check the length of string. More secure function snprintf is used. Fixes: 450f079131 ("power: add traffic pattern aware power control") Cc: stable@dpdk.org Signed-off-by: Pallantla Poornima --- lib/librte_power/rte_power_empty_poll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_power/rte_power_empty_poll.c b/lib/librte_power/rte_power_empty_poll.c index e6145462f..df00a3968 100644 --- a/lib/librte_power/rte_power_empty_poll.c +++ b/lib/librte_power/rte_power_empty_poll.c @@ -159,7 +159,7 @@ update_training_stats(struct priority_worker *poll_stats, char pfi_str[32]; uint64_t p0_empty_deq; - sprintf(pfi_str, "%02d", freq); + snprintf(pfi_str, sizeof(pfi_str), "%02d", freq); if (poll_stats->cur_freq == freq && poll_stats->thresh[freq].trained == false) {