Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
a3f99081
Commit
a3f99081
authored
Apr 23, 2012
by
antirez
Browse files
Remove loadfile() access from the scripting engine.
parent
eb6e7eb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scripting.c
View file @
a3f99081
...
@@ -412,6 +412,13 @@ void luaLoadLibraries(lua_State *lua) {
...
@@ -412,6 +412,13 @@ void luaLoadLibraries(lua_State *lua) {
#endif
#endif
}
}
/* Remove a functions that we don't want to expose to the Redis scripting
* environment. */
void
luaRemoveUnsupportedFunctions
(
lua_State
*
lua
)
{
lua_pushnil
(
lua
);
lua_setglobal
(
lua
,
"loadfile"
);
}
/* This function installs metamethods in the global table _G that prevent
/* This function installs metamethods in the global table _G that prevent
* the creation of globals accidentally.
* the creation of globals accidentally.
*
*
...
@@ -455,7 +462,9 @@ void scriptingEnableGlobalsProtection(lua_State *lua) {
...
@@ -455,7 +462,9 @@ void scriptingEnableGlobalsProtection(lua_State *lua) {
* See scriptingReset() for more information. */
* See scriptingReset() for more information. */
void
scriptingInit
(
void
)
{
void
scriptingInit
(
void
)
{
lua_State
*
lua
=
lua_open
();
lua_State
*
lua
=
lua_open
();
luaLoadLibraries
(
lua
);
luaLoadLibraries
(
lua
);
luaRemoveUnsupportedFunctions
(
lua
);
/* Initialize a dictionary we use to map SHAs to scripts.
/* Initialize a dictionary we use to map SHAs to scripts.
* This is useful for replication, as we need to replicate EVALSHA
* This is useful for replication, as we need to replicate EVALSHA
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment