summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-07-17 07:55:07 +0100
committerKatolaZ <katolaz@freaknet.org>2018-07-17 07:55:07 +0100
commitac38bc1facc5994417787908242dc0fa204d5851 (patch)
treec9d6021922588d48890f062ca4fe0316ded77ef7
parent1abda737941025df78ec2e1baa30ee696080b130 (diff)
better check on valid selectors
-rwxr-xr-xgosher10
1 files changed, 6 insertions, 4 deletions
diff --git a/gosher b/gosher
index 4bdb759..840b2b2 100755
--- a/gosher
+++ b/gosher
@@ -26,8 +26,8 @@ NETCAT=netcat
OPREFIX=/tmp/outf_
IPREFIX=/tmp/inf_
-DEBUG=
-##DEBUG=yes
+##DEBUG=
+DEBUG=yes
## function
@@ -121,9 +121,11 @@ selector=$(echo $selector | sed -r 's:\r::g' )
}
case $selector in
- /*|"")
+ /?*|"")
RP1=$(realpath "${GOPHERDIR}"/"${selector}" || "")
- RP2=$(realpath $(realpath "${GOPHERDIR}")"${selector}")
+ [ $? -eq 0 ] || invalid_selector "$selector"
+ RP2=$(realpath "${GOPHERDIR}")"${selector}"
+ [ $? -eq 0 ] || invalid_selector "$selector"
[ -n "$DEBUG" ] && {
echo "iRP1: ${RP1}"
echo "iRP2: ${RP2}"