[openwrt/openwrt] base-files: ipcalc.sh handle start and range being empty strings

LEDE Commits lede-commits at lists.infradead.org
Sun Jul 21 08:32:34 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0037100e129d3b2abedc08864c82230ab4565b21

commit 0037100e129d3b2abedc08864c82230ab4565b21
Author: Philip Prindeville <philipp at redfish-solutions.com>
AuthorDate: Sun Jul 14 14:07:53 2024 -0600

    base-files: ipcalc.sh handle start and range being empty strings
    
    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 at redfish-solutions.com>
    Link: https://github.com/openwrt/openwrt/pull/15946
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/base-files/files/bin/ipcalc.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh
index ae7a5c9598..871a49ed6e 100755
--- a/package/base-files/files/bin/ipcalc.sh
+++ b/package/base-files/files/bin/ipcalc.sh
@@ -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))




More information about the lede-commits mailing list