blob: 438ebbf346b96462c8f144affa77cb95189244ad [file] [log] [blame]
Description: if the shell is restricted, reject attempts to add pathnames
containing slashes to the hash table
Origin: backport, http://git.savannah.gnu.org/cgit/bash.git/commit/?h=bash-4.4-testing&id=a4eef1991c25c9d1c55f777952cd522c762c6fc3
Bug: https://savannah.gnu.org/support/?108969
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1803441
Index: bash-4.3/variables.c
===================================================================
--- bash-4.3.orig/variables.c 2019-07-12 14:12:19.000000000 -0400
+++ bash-4.3/variables.c 2019-07-12 14:24:58.364792719 -0400
@@ -1601,6 +1601,13 @@ assign_hashcmd (self, value, ind, key)
arrayind_t ind;
char *key;
{
+#if defined (RESTRICTED_SHELL)
+ if (restricted && strchr (value, '/'))
+ {
+ sh_restricted (value);
+ return (SHELL_VAR *)NULL;
+ }
+#endif
phash_insert (key, value, 0, 0);
return (build_hashcmd (self));
}