From patchwork Tue Apr 12 15:13:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mrzyglod X-Patchwork-Id: 12026 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 [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 6A31A2E8B; Tue, 12 Apr 2016 17:13:44 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 3B6392E8A for ; Tue, 12 Apr 2016 17:13:43 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 12 Apr 2016 08:13:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,474,1455004800"; d="scan'208";a="953380802" Received: from unknown ([10.217.248.155]) by orsmga002.jf.intel.com with SMTP; 12 Apr 2016 08:13:38 -0700 Received: by (sSMTP sendmail emulation); Tue, 12 Apr 2016 17:13:37 +0200 From: Daniel Mrzyglod To: dev@dpdk.org Cc: alan.carew@intel.com Date: Tue, 12 Apr 2016 17:13:06 +0200 Message-Id: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] examples/vm_power_manager: buffer not null terminated X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" CID30691: If the buffer is treated as a null terminated string in later operations, a buffer overflow or over-read may occur. In add_vm: The string buffer may not have a null terminator if the source string's length is equal to the buffer size Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host") Signed-off-by: Daniel Mrzyglod --- examples/vm_power_manager/channel_manager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 22c2ddd..b9265ce 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -666,7 +666,8 @@ add_vm(const char *vm_name) rte_free(new_domain); return -1; } - strncpy(new_domain->name, vm_name, sizeof(new_domain->name)); + strncat(new_domain->name, vm_name, sizeof(new_domain->name) - + strlen(new_domain->name) - 1); new_domain->channel_mask = 0; new_domain->num_channels = 0;