* [PATCH] tests/vhost-user-bridge.c: Sanity check socket path length
@ 2021-09-01 15:26 Peter Maydell
2021-09-01 16:48 ` Marc-André Lureau
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2021-09-01 15:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael S . Tsirkin
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tests/vhost-user-bridge.c: Sanity check socket path length
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
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2021-09-01 16:48 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU, Michael S . Tsirkin
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-01 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.