luci-app-mwan3: check policy name length on create
authorFlorian Eckert <fe@dev.tdt.de>
Wed, 14 Oct 2020 08:07:38 +0000 (10:07 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Wed, 14 Oct 2020 08:08:04 +0000 (10:08 +0200)
fixes #13499

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-mwan3/luasrc/model/cbi/mwan/policy.lua

index c2f47d6b2120ca6770e4942db2f00f4f5683bc99..9067f7332fa49ff37546b3c07a66dfcab24e9daa 100644 (file)
@@ -53,9 +53,13 @@ mwan_policy.sortable = true
 mwan_policy.template = "cbi/tblsection"
 mwan_policy.extedit = dsp.build_url("admin", "network", "mwan", "policy", "%s")
 function mwan_policy.create(self, section)
-       TypedSection.create(self, section)
-       m.uci:save("mwan3")
-       luci.http.redirect(dsp.build_url("admin", "network", "mwan", "policy", section))
+       if #section > 15 then
+               self.invalid_cts = true
+       else
+               TypedSection.create(self, section)
+               m.uci:save("mwan3")
+               luci.http.redirect(dsp.build_url("admin", "network", "mwan", "policy", section))
+       end
 end
 
 use_member = mwan_policy:option(DummyValue, "use_member", translate("Members assigned"))