Revision: 5224 http://geany.svn.sourceforge.net/geany/?rev=5224&view=rev Author: ntrel Date: 2010-09-13 15:03:18 +0000 (Mon, 13 Sep 2010)
Log Message: ----------- Fix some 'possible' NULL pointer dereferences (based on patch by Erik de Castro Lopo).
Modified Paths: -------------- trunk/ChangeLog trunk/src/search.c trunk/src/tools.c trunk/tagmanager/python.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-09-13 14:39:32 UTC (rev 5223) +++ trunk/ChangeLog 2010-09-13 15:03:18 UTC (rev 5224) @@ -5,6 +5,9 @@ Find Document Usage because Find Usage can be used instead. Go to Tag Declaration because Go to Tag Definition is more common. Go to Line because the toolbar item can be used instead. + * src/tools.c, src/search.c, tagmanager/python.c: + Fix some 'possible' NULL pointer dereferences (based on patch by + Erik de Castro Lopo).
2010-09-09 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/search.c =================================================================== --- trunk/src/search.c 2010-09-13 14:39:32 UTC (rev 5223) +++ trunk/src/search.c 2010-09-13 15:03:18 UTC (rev 5224) @@ -1505,7 +1505,7 @@ * Returns NULL if no files were found, otherwise returned vector should be fully freed. */ static gchar **search_get_argv(const gchar **argv_prefix, const gchar *dir) { - guint prefix_len, list_len, i, j; + guint prefix_len, list_len, i; gchar **argv; GSList *list, *item; GError *error = NULL; @@ -1520,21 +1520,18 @@ g_error_free(error); return NULL; } - if (list == NULL) return NULL; + if (list == NULL) + return NULL;
argv = g_new(gchar*, prefix_len + list_len + 1);
for (i = 0; i < prefix_len; i++) argv[i] = g_strdup(argv_prefix[i]);
- item = list; - for (j = 0; j < list_len; j++) - { + foreach_slist(item, list) argv[i++] = item->data; - item = g_slist_next(item); - } - argv[i] = NULL;
+ argv[i] = NULL; g_slist_free(list); return argv; }
Modified: trunk/src/tools.c =================================================================== --- trunk/src/tools.c 2010-09-13 14:39:32 UTC (rev 5223) +++ trunk/src/tools.c 2010-09-13 15:03:18 UTC (rev 5224) @@ -452,6 +452,7 @@ case 0: key_idx = GEANY_KEYS_FORMAT_SENDTOCMD1; break; case 1: key_idx = GEANY_KEYS_FORMAT_SENDTOCMD2; break; case 2: key_idx = GEANY_KEYS_FORMAT_SENDTOCMD3; break; + default: return; }
if (key_idx != -1)
Modified: trunk/tagmanager/python.c =================================================================== --- trunk/tagmanager/python.c 2010-09-13 14:39:32 UTC (rev 5223) +++ trunk/tagmanager/python.c 2010-09-13 15:03:18 UTC (rev 5224) @@ -411,9 +411,9 @@ { n = nls->levels + i; /* is there a better way to compare two vStrings? */ - if (strcmp(vStringValue(parent), vStringValue(n->name)) == 0) + if (n && strcmp(vStringValue(parent), vStringValue(n->name)) == 0) { - if (n && indent <= n->indentation) + if (indent <= n->indentation) { /* remove this level by clearing its name */ vStringClear(n->name);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.