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

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

index a197930a48309e438701360f9f21d877912808f0..1a97d40c1a95126a6644d7cef00376414e797d55 100644 (file)
@@ -61,9 +61,13 @@ mwan_rule.sortable = true
 mwan_rule.template = "cbi/tblsection"
 mwan_rule.extedit = dsp.build_url("admin", "network", "mwan", "rule", "%s")
 function mwan_rule.create(self, section)
-       TypedSection.create(self, section)
-       m.uci:save("mwan3")
-       luci.http.redirect(dsp.build_url("admin", "network", "mwan", "rule", 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", "rule", section))
+       end
 end
 
 src_ip = mwan_rule:option(DummyValue, "src_ip", translate("Source address"))