summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Donald2024-09-20 15:55:13 +0000
committerRobert Marko2025-10-30 11:10:12 +0000
commit6f78fa496bf36c55864a41e353df7d13f04b1077 (patch)
treee021d3362c84b51ebcdc32476c15ef5aec9fb33e
parentc75525a58a7ea1363f96bac9f9b4104971c1eb03 (diff)
downloadubox-master.tar.gz
ubox validate: port range check fixHEADmaster
The luci GUI allows a single port in a port range field. This additional check validates a single port if a range was not found. Signed-off-by: Paul Donald <newtwen+github@gmail.com> Link: https://github.com/openwrt/ubox/pull/7 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--validate/validate.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/validate/validate.c b/validate/validate.c
index e72b811..ffea1d5 100644
--- a/validate/validate.c
+++ b/validate/validate.c
@@ -597,8 +597,10 @@ dt_type_portrange(struct dt_state *s, int nargs)
n = strtoul(s->value, &e, 10);
- if (e == s->value || *e != '-')
- return false;
+ if (e == s->value || *e != '-') {
+ // If parsing as portrange fails, try parsing as a single port
+ return dt_type_port(s, nargs);
+ }
m = strtoul(e + 1, &e, 10);