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 8CA9EA04BA; Wed, 7 Oct 2020 17:03:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AAF391BC89; Wed, 7 Oct 2020 17:03:51 +0200 (CEST) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by dpdk.org (Postfix) with ESMTP id 548FE1BC84 for ; Wed, 7 Oct 2020 17:03:48 +0200 (CEST) Received: by mail-pj1-f48.google.com with SMTP id kk9so1178603pjb.2 for ; Wed, 07 Oct 2020 08:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bJeIFmZlGCBVSauyldK7D38L4SwU6H4ne2MSrItkG6E=; b=NBSchgxMGoQeJSvTfRfsLLC7PWS/B/UDta2tlS08ZvIBD9afDC5039SM16uU2FchL1 TFg7xSB+kQ7622WKMCN3/1bP/i74w2HELIqFYaZlOqWQi/KLCqrafO9Bxiai5yYItYFd zGTd9UYIU4gmCftV8nAN/UwHIBXMypqnC0Xt4UZ2a3akNJgo7peuqGobi8OzAKDMsl7M I7dHGi9+vsLbKw0SJNsiTFxQYXM1ZPZH1zZPDrBgrVWZ5kMvqdexiIlXKhj5lKwgU3zr vmQn8jU+UaW5UtHKpxXLcbleyeGmiZr4NWmEkOOSTVcOGHpThtzfSwGf6aQE7wlTKRI5 ntrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bJeIFmZlGCBVSauyldK7D38L4SwU6H4ne2MSrItkG6E=; b=ucK74rp/cPCgNc8BVzR8/n+ZNtHZzmZ9keDc6tji8FsD10IDRD0AohfVUUIw3qYHf4 S9dU0yA211IPWBxymMLqCh6kae9SBz55UziJ2GDZzM2oDju5m1NAQKIQ9aBHlYdp6GDq VzogVe8s+CzWQzY2iH/m2pselH07WdJt//S9VWbWh71oXTmf5R7w4p74bwzAvnWWh0vK x2cMV8RSUzcJQB9fydIfQg+PjC3BLnfo3Mq79dHjF/++3INEcg/zeNb856FsyCDlJRAB MaVk8ZQDG3MIjvNG2JrAkXtYIdsqq3je8nATPMHa1p/b/Fj/PcR8okz7tb45fgkTJP6L wbLw== X-Gm-Message-State: AOAM530CtbSkHtOq01qpJfW1zZiYysugG+a8cwAeiLEulWchS2/aRDtz g+UW7ep6ixJxd/yj7d4ziUcpQIP9He8zxw== X-Google-Smtp-Source: ABdhPJxXnRJ2ZcmQFJyEEQZibaOnC9n6VUm/tkAu6lG3gcA8i971NEozwoWmNVuECBDxngHfC62LbQ== X-Received: by 2002:a17:90a:bd0e:: with SMTP id y14mr3260305pjr.11.1602083026519; Wed, 07 Oct 2020 08:03:46 -0700 (PDT) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id n67sm3548061pgn.14.2020.10.07.08.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 08:03:46 -0700 (PDT) Date: Wed, 7 Oct 2020 08:03:38 -0700 From: Stephen Hemminger To: Jakub Grajciar Cc: Message-ID: <20201007080338.537949de@hermes.local> In-Reply-To: <20201005123900.32723-1-jgrajcia@cisco.com> References: <20201005123900.32723-1-jgrajcia@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 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.