qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-bridge-helper: restrict bridge name to IFNAMSIZ
@ 2019-06-28  9:49 P J P
  2019-06-28 11:04 ` Daniel P. Berrangé
  2019-06-28 11:42 ` Li Qiang
  0 siblings, 2 replies; 7+ messages in thread
From: P J P @ 2019-06-28  9:49 UTC (permalink / raw)
  To: Qemu Developers; +Cc: Riccardo Schirone, Daniel P . Berrange, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

The interface names in qemu-bridge-helper are 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 ACLs rules. If user supplied '--br=bridge' name
is not restricted to the same length, it could lead to ACL bypass
issue. Restrict bridge 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
index f9940deefd..2eca8c5cc4 100644
--- a/qemu-bridge-helper.c
+++ b/qemu-bridge-helper.c
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
         if (strcmp(argv[index], "--use-vnet") == 0) {
             use_vnet = 1;
         } else if (strncmp(argv[index], "--br=", 5) == 0) {
-            bridge = &argv[index][5];
+            bridge = strndup(&argv[index][5], IFNAMSIZ - 1);
         } else if (strncmp(argv[index], "--fd=", 5) == 0) {
             unixfd = atoi(&argv[index][5]);
         } else {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-28 14:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28  9:49 [Qemu-devel] [PATCH] qemu-bridge-helper: restrict bridge name to IFNAMSIZ P J P
2019-06-28 11:04 ` Daniel P. Berrangé
2019-06-28 11:21   ` P J P
2019-06-28 11:32     ` Daniel P. Berrangé
2019-06-28 12:02       ` P J P
2019-06-28 12:18         ` Daniel P. Berrangé
2019-06-28 11:42 ` Li Qiang

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).