]> git.corax.cc Git - toolbox/commitdiff
toolbox: Make have(), _try_include(), include() read-only
authorMatthias Kruk <m@m10k.eu>
Mon, 14 Jun 2021 21:23:02 +0000 (06:23 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 14 Jun 2021 21:23:02 +0000 (06:23 +0900)
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

index 6261219c688638a03b197eb398a427ae10351dca..f690b01d09c18e410922540ef96ab078cbf1d296 100644 (file)
@@ -33,6 +33,10 @@ __toolbox_init() {
 
        declare -Axg __TOOLBOX_INCLUDED
 
+       readonly -f have
+       readonly -f _try_include
+       readonly -f include
+
        return 0
 }