DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	Jakub Grajciar <jgrajcia@cisco.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] net/memif: use abstract socket address
Date: Fri, 9 Oct 2020 16:09:11 +0100
Message-ID: <ef535dc8-0a00-ca3c-5e08-a752c6bbb0f6@intel.com> (raw)
In-Reply-To: <20201007080338.537949de@hermes.local>

On 10/7/2020 4:03 PM, Stephen Hemminger wrote:
> On Mon, 5 Oct 2020 14:39:00 +0200
> Jakub Grajciar <jgrajcia@cisco.com> 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?

      reply	other threads:[~2020-10-09 15:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 12:39 Jakub Grajciar
2020-10-05 13:09 ` Ferruh Yigit
2020-10-05 15:23   ` Jakub Grajciar -X (jgrajcia - PANTHEON TECH SRO at Cisco)
2020-10-05 18:17   ` Stephen Hemminger
2020-10-06  8:59     ` Ferruh Yigit
2020-10-07 10:00 ` [dpdk-dev] [PATCH v2] " Jakub Grajciar
2020-10-09 16:58   ` [dpdk-dev] [PATCH v3] " Jakub Grajciar
2020-10-09 17:17     ` Ferruh Yigit
2020-10-12  8:28     ` [dpdk-dev] [PATCH v4] " Jakub Grajciar
2020-10-12 14:57       ` Ferruh Yigit
2020-10-12 15:17       ` Stephen Hemminger
2020-10-07 15:03 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2020-10-09 15:09   ` Ferruh Yigit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef535dc8-0a00-ca3c-5e08-a752c6bbb0f6@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=jgrajcia@cisco.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git