From patchwork Tue May 10 15:49:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mrzyglod X-Patchwork-Id: 12657 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 BA1EFAD7F; Tue, 10 May 2016 16:48:56 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 449EDAA3C for ; Tue, 10 May 2016 16:48:55 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 10 May 2016 07:48:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,604,1455004800"; d="scan'208";a="976692487" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga002.fm.intel.com with SMTP; 10 May 2016 07:48:52 -0700 Received: by Sent (sSMTP sendmail emulation); Tue, 10 May 2016 17:49:35 +0200 From: Daniel Mrzyglod To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, Daniel Mrzyglod Date: Tue, 10 May 2016 17:49:22 +0200 Message-Id: <1462895362-29323-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com> Subject: [dpdk-dev] [PATCH v2] 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 22c2ddd..e068ae2 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -667,6 +667,7 @@ add_vm(const char *vm_name) return -1; } strncpy(new_domain->name, vm_name, sizeof(new_domain->name)); + new_domain->name[sizeof(new_domain->name) - 1] = '\0'; new_domain->channel_mask = 0; new_domain->num_channels = 0;