From 9f01ef1fa73cac2f4cc0766662af69881f1fbcdc Mon Sep 17 00:00:00 2001 From: dteske Date: Thu, 31 Jul 2014 22:13:31 +0000 Subject: Update command and add check for edge-case. --- usr.sbin/bsdconfig/share/common.subr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.sbin/bsdconfig') diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index 6ce1956..57c4125 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -222,7 +222,7 @@ f_have() # setvar $var_to_set [$value] # -# Implement setvar for shells such as unlike FreeBSD sh(1). +# Implement setvar for shells unlike FreeBSD sh(1). # if ! f_have setvar; then setvar() @@ -236,6 +236,10 @@ setvar() *) f_err "setvar: too many arguments\n" return $FAILURE esac + case "$__setvar_var_to_set" in *[!0-9A-Za-z_]*) + f_err "setvar: %s: bad variable name\n" "$__setvar_var_to_set" + return 2 + esac while case "$__setvar_r" in *\'*) : ;; *) false ; esac do __setvar_left="$__setvar_left${__setvar_right%%\'*}'\\''" -- cgit v1.1