summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2020-10-08 14:35:20 +0000
committerkn <kn@openbsd.org>2020-10-08 14:35:20 +0000
commit2af1a500aa8e963e3a2ad840ef3b35b8eaff7568 (patch)
tree52b1c07b0b1c7b60d9f1ac825785f9f2904df254
parentPrint usage to stderr, print error messages in errx(3) fashion (diff)
downloadwireguard-openbsd-2af1a500aa8e963e3a2ad840ef3b35b8eaff7568.tar.xz
wireguard-openbsd-2af1a500aa8e963e3a2ad840ef3b35b8eaff7568.zip
Fail on invalid installurl
Validate the URL's protocol identifier to avoid passing bogus arguments to ftp(1) which otherwise might drop into the "ftp> " prompt instead of causing sysupgrade(8) to exit non-zero. Code taken from syspatch(8) as advised by ajacoutot. Feedback jca Feedback OK naddy
-rw-r--r--usr.sbin/sysupgrade/sysupgrade.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh
index db19bd8a25f..66ebfe9ce16 100644
--- a/usr.sbin/sysupgrade/sysupgrade.sh
+++ b/usr.sbin/sysupgrade/sysupgrade.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: sysupgrade.sh,v 1.41 2020/10/08 14:26:34 kn Exp $
+# $OpenBSD: sysupgrade.sh,v 1.42 2020/10/08 14:35:20 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org>
@@ -108,6 +108,8 @@ case $# in
;;
*) usage
esac
+[[ $MIRROR == @(file|ftp|http|https)://* ]] ||
+ ug_err "invalid installurl: $MIRROR"
if ! $RELEASE && [[ ${#_KERNV[*]} == 2 ]]; then
SNAP=true