public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH 1/3] conf: Fix incorrect bounds checking for sock_path parameter
Date: Tue, 23 Aug 2022 16:31:49 +1000	[thread overview]
Message-ID: <20220823063151.854034-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220823063151.854034-1-david@gibson.dropbear.id.au>

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

Looks like a copy-paste error where we're checking against the size of the
pcap field, rather than the sock_path field.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/conf.c b/conf.c
index 83b2fe5..ac81c15 100644
--- a/conf.c
+++ b/conf.c
@@ -1269,7 +1269,7 @@ void conf(struct ctx *c, int argc, char **argv)
 
 			ret = snprintf(c->sock_path, UNIX_SOCK_MAX - 1, "%s",
 				       optarg);
-			if (ret <= 0 || ret >= (int)sizeof(c->pcap)) {
+			if (ret <= 0 || ret >= (int)sizeof(c->sock_path)) {
 				err("Invalid socket path: %s", optarg);
 				usage(argv[0]);
 			}
-- 
@@ -1269,7 +1269,7 @@ void conf(struct ctx *c, int argc, char **argv)
 
 			ret = snprintf(c->sock_path, UNIX_SOCK_MAX - 1, "%s",
 				       optarg);
-			if (ret <= 0 || ret >= (int)sizeof(c->pcap)) {
+			if (ret <= 0 || ret >= (int)sizeof(c->sock_path)) {
 				err("Invalid socket path: %s", optarg);
 				usage(argv[0]);
 			}
-- 
2.37.2


  reply	other threads:[~2022-08-23  6:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  6:31 [PATCH 0/3] Miscellaneous small fixes David Gibson
2022-08-23  6:31 ` David Gibson [this message]
2022-08-23  6:31 ` [PATCH 2/3] gitignore README.plain.md David Gibson
2022-08-23  6:31 ` [PATCH 3/3] Don't unnecessarily avoid CLOEXEC flags David Gibson
2022-08-24 20:20   ` Stefano Brivio
2022-08-24 20:21 ` [PATCH 0/3] Miscellaneous small fixes Stefano Brivio

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=20220823063151.854034-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).