From 394e5ac616303b237a70a6ad9fc7c0e170c9c201 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Tue, 15 Jun 2021 06:23:02 +0900 Subject: [PATCH] toolbox: Make have(), _try_include(), include() read-only Functions from toolbox.sh may be redeclared, causing all sorts of problems from simple bugs to security issues. This commit makes sure the functions are declared read-only when toolbox is loaded so the user can't shoot themself in the foot. --- toolbox.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toolbox.sh b/toolbox.sh index 6261219..f690b01 100644 --- a/toolbox.sh +++ b/toolbox.sh @@ -33,6 +33,10 @@ __toolbox_init() { declare -Axg __TOOLBOX_INCLUDED + readonly -f have + readonly -f _try_include + readonly -f include + return 0 } -- 2.47.3