From: P J P <ppandit@redhat.com>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: "Riccardo Schirone" <rschiron@redhat.com>,
"Li Qiang" <liq3ea@gmail.com>, "Jason Wang" <jasowang@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Prasad J Pandit" <pjp@fedoraproject.org>
Subject: [Qemu-devel] [PATCH v4 1/3] qemu-bridge-helper: restrict interface name to IFNAMSIZ
Date: Tue, 23 Jul 2019 16:17:52 +0530 [thread overview]
Message-ID: <20190723104754.29324-2-ppandit@redhat.com> (raw)
In-Reply-To: <20190723104754.29324-1-ppandit@redhat.com>
From: Prasad J Pandit <pjp@fedoraproject.org>
The network interface name in Linux is defined to be of size
IFNAMSIZ(=16), including the terminating null('\0') byte.
The same is applied to interface names read from 'bridge.conf'
file to form ACL rules. If user supplied '--br=bridge' name
is not restricted to the same length, it could lead to ACL bypass
issue. Restrict interface name to IFNAMSIZ, including null byte.
Reported-by: Riccardo Schirone <rschiron@redhat.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
qemu-bridge-helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Reviewed v3
-> https://lists.nongnu.org/archive/html/qemu-devel/2019-07/msg00245.html
diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
index f9940deefd..e90c22f07d 100644
--- a/qemu-bridge-helper.c
+++ b/qemu-bridge-helper.c
@@ -109,6 +109,13 @@ static int parse_acl_file(const char *filename, ACLList *acl_list)
}
*argend = 0;
+ if (!g_str_equal(cmd, "include") && strlen(arg) >= IFNAMSIZ) {
+ fprintf(stderr, "name `%s' too long: %zu\n", arg, strlen(arg));
+ fclose(f);
+ errno = EINVAL;
+ return -1;
+ }
+
if (strcmp(cmd, "deny") == 0) {
acl_rule = g_malloc(sizeof(*acl_rule));
if (strcmp(arg, "all") == 0) {
@@ -259,6 +266,10 @@ int main(int argc, char **argv)
usage();
return EXIT_FAILURE;
}
+ if (strlen(bridge) >= IFNAMSIZ) {
+ fprintf(stderr, "name `%s' too long: %zu\n", bridge, strlen(bridge));
+ return EXIT_FAILURE;
+ }
/* parse default acl file */
QSIMPLEQ_INIT(&acl_list);
--
2.21.0
next prev parent reply other threads:[~2019-07-23 10:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 10:47 [Qemu-devel] [PATCH v4 0/3] restrict bridge interface name to IFNAMSIZ P J P
2019-07-23 10:47 ` P J P [this message]
2019-07-23 13:10 ` [Qemu-devel] [PATCH v4 1/3] qemu-bridge-helper: restrict " Stefan Hajnoczi
2019-07-23 13:12 ` Daniel P. Berrangé
2019-07-23 15:07 ` Li Qiang
2019-07-23 10:47 ` [Qemu-devel] [PATCH v4 2/3] qemu-bridge-helper: move repeating code in parse_acl_file P J P
2019-07-23 13:00 ` Stefan Hajnoczi
2019-07-23 13:12 ` Daniel P. Berrangé
2019-07-23 15:07 ` Li Qiang
2019-07-23 10:47 ` [Qemu-devel] [PATCH v4 3/3] net: tap: replace snprintf with g_strdup_printf calls P J P
2019-07-23 13:03 ` Stefan Hajnoczi
2019-07-23 15:43 ` Li Qiang
2019-07-24 5:48 ` P J P
2019-07-29 15:04 ` Stefan Hajnoczi
2019-07-31 4:58 ` Jason Wang
2019-07-31 6:42 ` P J P
2019-07-31 6:59 ` Jason Wang
2019-07-31 9:23 ` P J P
2019-07-23 13:13 ` Daniel P. Berrangé
2019-07-23 17:44 ` [Qemu-devel] [PATCH v4 0/3] restrict bridge interface name to IFNAMSIZ no-reply
2019-07-25 4:01 ` Jason Wang
2019-07-25 10:20 ` P J P
2019-07-26 10:26 ` Jason Wang
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=20190723104754.29324-2-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=berrange@redhat.com \
--cc=jasowang@redhat.com \
--cc=liq3ea@gmail.com \
--cc=pjp@fedoraproject.org \
--cc=qemu-devel@nongnu.org \
--cc=rschiron@redhat.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).