From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61C5CA0471 for ; Tue, 16 Jul 2019 13:23:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 251582C18; Tue, 16 Jul 2019 13:23:34 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 748F82BF4; Tue, 16 Jul 2019 13:23:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2019 04:23:30 -0700 X-IronPort-AV: E=Sophos;i="5.63,498,1557212400"; d="scan'208";a="178520273" Received: from dhunt5-mobl4.ger.corp.intel.com (HELO [10.237.221.141]) ([10.237.221.141]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 16 Jul 2019 04:23:28 -0700 To: Thomas Monjalon Cc: dev@dpdk.org, stable@dpdk.org, bruce.richardson@intel.com, anatoly.burakov@intel.com References: <20190712140402.8492-1-david.hunt@intel.com> <20190716082405.22394-1-david.hunt@intel.com> <1731111.OQE5oHDSl3@xps> From: "Hunt, David" Message-ID: Date: Tue, 16 Jul 2019 12:23:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1731111.OQE5oHDSl3@xps> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] examples/vm_power: fix strcpy buffer overrun 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" On 16/07/2019 12:05, Thomas Monjalon wrote: > 16/07/2019 10:24, David Hunt: >> replace strcpy with strlcpy to prevent buffer overrun >> With fix, attempting to use a VERY lonng vm name results in a nicely >> truncated 32 character name rather than a segfault: >> Setting VM Name to [sdfdsfsfsdffdsdsasdsadasdakjshd] >> >> Using strlcpy rather than rte_strlcpy, as the rte_ version is only a >> fallback. >> >> As well as the fix in main.c, this patch also changes an occurrence of >> rte_strlcpy in channel_manager.c and channel_monitor.c to strlcpy. > [...] >> --- a/examples/vm_power_manager/guest_cli/main.c >> +++ b/examples/vm_power_manager/guest_cli/main.c >> - strcpy(policy->vm_name, optarg); >> + rte_strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ); > This is still using rte_strlcpy !! Apologies, too many balls in the air.  v3 pushed.