All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU <qemu-devel@nongnu.org>, "Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] tests/vhost-user-bridge.c: Sanity check socket path length
Date: Wed, 1 Sep 2021 20:48:57 +0400	[thread overview]
Message-ID: <CAJ+F1CJok+8MvmLLgwb10=+Pz=YetZBBQbuYaHu_5gLSR-hydA@mail.gmail.com> (raw)
In-Reply-To: <20210901152632.25511-1-peter.maydell@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

On Wed, Sep 1, 2021 at 8:36 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> The vhost-user-bridge binary accepts a UNIX socket path on
> the command line. Sanity check that this is short enough to
> fit into a sockaddr_un before copying it in.
>
> Fixes: Coverity CID 1432866
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  tests/vhost-user-bridge.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
> index 24815920b2b..cb009545fa5 100644
> --- a/tests/vhost-user-bridge.c
> +++ b/tests/vhost-user-bridge.c
> @@ -540,6 +540,11 @@ vubr_new(const char *path, bool client)
>      CallbackFunc cb;
>      size_t len;
>
> +    if (strlen(path) >= sizeof(un.sun_path)) {
> +        fprintf(stderr, "unix domain socket path '%s' is too long\n",
> path);
> +        exit(1);
> +    }
> +
>      /* Get a UNIX socket. */
>      dev->sock = socket(AF_UNIX, SOCK_STREAM, 0);
>      if (dev->sock == -1) {
> --
> 2.20.1
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1919 bytes --]

      reply	other threads:[~2021-09-01 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 15:26 [PATCH] tests/vhost-user-bridge.c: Sanity check socket path length Peter Maydell
2021-09-01 16:48 ` Marc-André Lureau [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='CAJ+F1CJok+8MvmLLgwb10=+Pz=YetZBBQbuYaHu_5gLSR-hydA@mail.gmail.com' \
    --to=marcandre.lureau@gmail.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.