summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/control.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/control.sh b/lib/control.sh
index 04a0cba..746863e 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -157,6 +157,15 @@ ob_set_substvar()
return ${?}
fi
+ # Convert variable name to uppercase and validate.
+ _obssv_name="$(echo "${_obssv_name}" | tr 'a-z-' 'A-Z_')"
+ case "${_obssv_name:- }" in
+ *[!A-Z0-9_]*)
+ _ob_return 125
+ return ${?}
+ ;;
+ esac
+
# Trim leading and trailing whitespace from value.
_obssv_value="$(echo "${_obssv_value}" | sed -n '
H; # Store each input line in the hold space.
@@ -168,7 +177,6 @@ ob_set_substvar()
};
')"
- _obssv_name="$(echo "${_obssv_name}" | tr 'a-z-' 'A-Z_')"
eval "_OB_SUBSTVAR_${_obssv_name}='${_obssv_value}'"
_ob_return 125