Skip to content
Permalink
Browse files

Fix warning reported by clang (possible bug in Settings lua api)

  • Loading branch information
sfan5 committed Dec 21, 2016
1 parent 04f68a8 commit cc7c31a5bc44ab0010997e86c0a8c9f5f832b398
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/script/lua_api/l_settings.cpp
@@ -194,7 +194,7 @@ void LuaSettings::Register(lua_State* L)
int LuaSettings::create_object(lua_State* L)
{
NO_MAP_LOCK_REQUIRED;
bool write_allowed;
bool write_allowed = true;
const char* filename = luaL_checkstring(L, 1);
CHECK_SECURE_PATH_POSSIBLE_WRITE(L, filename, &write_allowed);
LuaSettings* o = new LuaSettings(filename, write_allowed);

4 comments on commit cc7c31a

@ShadowNinja

This comment has been minimized.

Copy link
Member

@ShadowNinja ShadowNinja replied Dec 21, 2016

I don't think that's it unfortunately, since checkPath unconditionally sets it to false (if it's passed) before doing anything just to be safe.

@sfan5

This comment has been minimized.

Copy link
Member Author

@sfan5 sfan5 replied Dec 21, 2016

This doesn't fix #4943 for the case where mod security is enabled, it is only supposed to fix the case where mod security is disabled, CHECK_SECURE_PATH_POSSIBLE_WRITE does nothing and write_allowed is used uninitialized.

Besides, I have actually verified that this fixes the bug with mod security disabled.

@est31

This comment has been minimized.

Copy link
Contributor

@est31 est31 replied Dec 21, 2016

@ShadowNinja From looking at the definition of CHECK_SECURE_PATH_POSSIBLE_WRITE it should be obvious that this change is needed.

@ShadowNinja

This comment has been minimized.

Copy link
Member

@ShadowNinja ShadowNinja replied Dec 21, 2016

@sfan5: Oh, you're right. This must have been the cause of #4943, mod security was off.

Please sign in to comment.
You can’t perform that action at this time.