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 CC465A04BC; Fri, 9 Oct 2020 17:09:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 150EB1D670; Fri, 9 Oct 2020 17:09:20 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 32F731D66F for ; Fri, 9 Oct 2020 17:09:18 +0200 (CEST) IronPort-SDR: 6Ae3G+U4vNrhH7ViJO4o9RwZ69w2N0TPaw9G4DUrJDW2ejXiGewaGBD5dnQCdUAnbxmcxNF8Qu nqDQ2t1cXrpQ== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="153330115" X-IronPort-AV: E=Sophos;i="5.77,355,1596524400"; d="scan'208";a="153330115" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 08:09:16 -0700 IronPort-SDR: EydXLrKphAnCfwWkpv8oD91/1sonQQPLgODRViF1Q+Odqyn2MNZa4isQ/rdHz6oVJl1J6Hcw66 PGtVq33cFBZQ== X-IronPort-AV: E=Sophos;i="5.77,355,1596524400"; d="scan'208";a="462223878" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.18.7]) ([10.252.18.7]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 08:09:14 -0700 To: Stephen Hemminger , Jakub Grajciar Cc: dev@dpdk.org References: <20201005123900.32723-1-jgrajcia@cisco.com> <20201007080338.537949de@hermes.local> From: Ferruh Yigit Message-ID: Date: Fri, 9 Oct 2020 16:09:11 +0100 MIME-Version: 1.0 In-Reply-To: <20201007080338.537949de@hermes.local> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] net/memif: use abstract socket address 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 10/7/2020 4:03 PM, Stephen Hemminger wrote: > On Mon, 5 Oct 2020 14:39:00 +0200 > Jakub Grajciar wrote: > >> @@ -886,7 +886,12 @@ memif_socket_create(char *key, uint8_t listener) >> goto error; >> >> un.sun_family = AF_UNIX; >> - strlcpy(un.sun_path, sock->filename, MEMIF_SOCKET_UN_SIZE); >> + if (is_abstract) { >> + // abstract address > No C++ comments please. > >> + un.sun_path[0] = '\0'; > Already set to zero when initialized. > >> + if (pmd->flags & ETH_MEMIF_FLAG_SOCKET_ABSTRACT) { >> + // abstract address > ditto no C++ comments > >> + sun.sun_path[0] = '\0'; > again zeroed again > >> + memcpy(sun.sun_path + 1, pmd->socket_filename, sizeof(sun.sun_path) - 2); >> + } else >> + memcpy(sun.sun_path, pmd->socket_filename, sizeof(sun.sun_path) - 1); > > This code is buggy since it potentially reads past the end of the strinc in filename. > Use strlcpy here instead. > Hi Jakub, v2 is still using memcpy, have you seen Stephen's comment above?