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 [thread overview]
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.
next prev 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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).