|
|
919688 |
From d4348cbbdbdba5d045b5b389ba6ce97b74936f30 Mon Sep 17 00:00:00 2001
|
|
|
919688 |
From: Benjamin Berg <bberg@redhat.com>
|
|
|
919688 |
Date: Mon, 15 Jun 2020 16:17:43 +0200
|
|
|
919688 |
Subject: [PATCH] p2p: Limit P2P_DEVICE name to appropriate ifname size
|
|
|
919688 |
|
|
|
919688 |
Otherwise the WPA_IF_P2P_DEVICE cannot be created. As this is not a
|
|
|
919688 |
netdev device, it is acceptable if the name is not completely unique. As
|
|
|
919688 |
such, simply insert a NUL byte at the appropriate place.
|
|
|
919688 |
---
|
|
|
919688 |
wpa_supplicant/p2p_supplicant.c | 4 ++++
|
|
|
919688 |
1 file changed, 4 insertions(+)
|
|
|
919688 |
|
|
|
919688 |
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
|
|
|
919688 |
index e94bffe52..17c25889c 100644
|
|
|
919688 |
--- a/wpa_supplicant/p2p_supplicant.c
|
|
|
919688 |
+++ b/wpa_supplicant/p2p_supplicant.c
|
|
|
919688 |
@@ -3929,6 +3929,10 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s,
|
|
|
919688 |
wpa_s->ifname);
|
|
|
919688 |
if (os_snprintf_error(sizeof(ifname), ret))
|
|
|
919688 |
return -1;
|
|
|
919688 |
+ /* Cut length at the maximum size. Note that we don't need to ensure
|
|
|
919688 |
+ * collision free names here as the created interface is not a netdev.
|
|
|
919688 |
+ */
|
|
|
919688 |
+ ifname[IFNAMSIZ-1] = '\0';
|
|
|
919688 |
force_name[0] = '\0';
|
|
|
919688 |
wpa_s->pending_interface_type = WPA_IF_P2P_DEVICE;
|
|
|
919688 |
ret = wpa_drv_if_add(wpa_s, WPA_IF_P2P_DEVICE, ifname, NULL, NULL,
|
|
|
919688 |
--
|
|
|
919688 |
2.26.2
|
|
|
919688 |
|