Skip to content

Commit

Permalink
luci-mod-network: improve static lease ip validation logic
Browse files Browse the repository at this point in the history
m (mac) is an array, and is zero length or greater.

Signed-off-by: Paul Donald <[email protected]>
  • Loading branch information
systemcrash committed Jan 25, 2024
1 parent 754b36d commit f6cbda0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -942,10 +942,10 @@ return view.extend({
var m = this.section.formvalue(section, 'mac'),
n = this.section.formvalue(section, 'name');

if ((m == null || m == '') && (n == null || n == ''))
if ((m && !m.length > 0) && !n)
return _('One of hostname or MAC address must be specified!');

if (value == null || value == '' || value == 'ignore')
if (!value || value == 'ignore')
return true;

var leases = uci.sections('dhcp', 'host');
Expand Down

0 comments on commit f6cbda0

Please sign in to comment.