base-files: ipcalc.sh handle start and range being empty strings
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sun, 14 Jul 2024 20:07:53 +0000 (14:07 -0600)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 21 Jul 2024 15:31:59 +0000 (17:31 +0200)
If we're being paranoid and quote all the arguments to ipcalc.sh,
it's possible to pass in empty start and range arguments.  This
should be handled the same as their being absent.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Link: https://github.com/openwrt/openwrt/pull/15946
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/base-files/files/bin/ipcalc.sh

index ae7a5c9598814f37cd487c4f240ee6ad0a717d6a..871a49ed6e73170f70ff088f0bea36d51ce36c76 100755 (executable)
@@ -96,6 +96,7 @@ echo "COUNT=$count"
 
 # if there's no range, we're done
 [ $# -eq 0 ] && exit 0
+[ -z "$1$2" ] && exit 0
 
 if [ "$prefix" -le 30 ]; then
     lower=$((network + 1))