DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Jakub Grajciar <jgrajcia@cisco.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/memif: use abstract socket address
Date: Wed, 7 Oct 2020 08:03:38 -0700
Message-ID: <20201007080338.537949de@hermes.local> (raw)
In-Reply-To: <20201005123900.32723-1-jgrajcia@cisco.com>

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.

  parent reply	other threads:[~2020-10-07 15:03 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 ` Stephen Hemminger [this message]
2020-10-09 15:09   ` [dpdk-dev] [PATCH] " Ferruh Yigit

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=20201007080338.537949de@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=jgrajcia@cisco.com \
    /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