summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-10-25 23:16:13 +0200
committerJo-Philipp Wich <jo@mein.io>2023-10-25 23:16:13 +0200
commit25dd8934f18a6cebfca1adb8a0d4b5d0bed73145 (patch)
treee5aec61a9fe3b0fdb5d6439833938870f6222540
parent575ce5512df534b52185af877d26192adde6a9b5 (diff)
luci-mod-status: protect against infinite recursion in port status
When attempting to resolve VLAN devices, protect against potential deep recursion due to invalid bridge configs referencing themselves. Fixes: #6648 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
index 1351ab935a..9ea5555deb 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
@@ -138,15 +138,24 @@ function buildVLANMappings(mapping)
}
}
-function resolveVLANPorts(ifname, mapping)
+function resolveVLANPorts(ifname, mapping, seen)
{
var ports = [];
- if (mapping[ifname])
- for (var i = 0; i < mapping[ifname].length; i++)
- ports.push.apply(ports, resolveVLANPorts(mapping[ifname][i], mapping));
- else
+ if (!seen)
+ seen = {};
+
+ if (mapping[ifname]) {
+ for (var i = 0; i < mapping[ifname].length; i++) {
+ if (!seen[mapping[ifname][i]]) {
+ seen[mapping[ifname][i]] = true;
+ ports.push.apply(ports, resolveVLANPorts(mapping[ifname][i], mapping, seen));
+ }
+ }
+ }
+ else {
ports.push(ifname);
+ }
return ports.sort(L.naturalCompare);
}