[source] dslite: Quote resolveip hostname argument

LEDE Commits lede-commits at lists.infradead.org
Thu Oct 6 03:16:17 PDT 2016


jow pushed a commit to source.git, branch master:
https://git.lede-project.org/34528c4807de017c359d87d0cd3c415cc0ae1893

commit 34528c4807de017c359d87d0cd3c415cc0ae1893
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Thu Oct 6 09:13:40 2016 +0200

    dslite: Quote resolveip hostname argument
    
    Quote resolveip hostname argument to avoid bad shell injections.
    While at it fix pattern match logic in case multiple IPv6 addresses
    are returned for a hostname as they're seperated by newline by
    resolveip and not a white space
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/ipv6/ds-lite/Makefile        |  2 +-
 package/network/ipv6/ds-lite/files/dslite.sh | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/package/network/ipv6/ds-lite/Makefile b/package/network/ipv6/ds-lite/Makefile
index 919ac7e..58e7156 100644
--- a/package/network/ipv6/ds-lite/Makefile
+++ b/package/network/ipv6/ds-lite/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ds-lite
 PKG_VERSION:=7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/ipv6/ds-lite/files/dslite.sh b/package/network/ipv6/ds-lite/files/dslite.sh
index a7e0a10..2485a42 100755
--- a/package/network/ipv6/ds-lite/files/dslite.sh
+++ b/package/network/ipv6/ds-lite/files/dslite.sh
@@ -26,16 +26,20 @@ proto_dslite_setup() {
 
 	( proto_add_host_dependency "$cfg" "::" "$tunlink" )
 
-	remoteip6=$(resolveip -6 $peeraddr)
+	remoteip6=$(resolveip -6 "$peeraddr")
 	if [ -z "$remoteip6" ]; then
 		sleep 3
-		remoteip6=$(resolveip -6 $peeraddr)
+		remoteip6=$(resolveip -6 "$peeraddr")
 		if [ -z "$remoteip6" ]; then
 			proto_notify_error "$cfg" "AFTR_DNS_FAIL"
 			return
 		fi
 	fi
-	peeraddr="${remoteip6%% *}"
+
+	for ip6 in $remoteip6; do
+		peeraddr=$ip6
+		break
+	done
 
 	[ -z "$ip6addr" ] && {
 		local wanif="$tunlink"



More information about the lede-commits mailing list