Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 05 Mar 2015 01:17:07 UTC Commit: 007c9d3284c2d2510cfb8507f2a4ed8970dcb7e1 https://github.com/geany/geany-plugins/commit/007c9d3284c2d2510cfb8507f2a4ed...
Log Message: ----------- geanylua: Fix possible NULL pointer dereference
`word_char` was only conditionally set to a non-NULL value, but unconditionally dereferenced through a `strchr()` call. While it seems highly unlikely to actually happen, play it safe and set the fallback value by default.
Found by cppcheck.
Modified Paths: -------------- geanylua/glspi_sci.c
Modified: geanylua/glspi_sci.c 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -229,7 +229,7 @@ static gint glspi_batch(lua_State* L) /* Return the "word" at the given position */ static gint glspi_word(lua_State* L) { - const gchar* word_chars = NULL; + const gchar* word_chars = GEANY_WORDCHARS; gint pos,linenum, bol, bow, eow; gchar *text=NULL; DOC_REQUIRED @@ -251,7 +251,6 @@ static gint glspi_word(lua_State* L) if (lua_isstring(L, -1)) { word_chars=lua_tostring(L, -1); } else { - word_chars=GEANY_WORDCHARS; lua_getglobal(L, LUA_MODULE_NAME); lua_pushstring(L,tokenWordChars); lua_pushstring(L,word_chars);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).