commit ace330d0e991cc03340135c5eafa509337ab5755
parent 0ea8cc7e15b0f7d210f7b891df71ce0b5f9abd7d
Author: Ricardo Mones <ricardo@mones.org>
Date: Fri, 2 Aug 2013 10:00:34 +0200
Fix access beyond array bounds
Which shouldn't happen, but keeps the compiler happy...
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/toolbar.c b/src/toolbar.c
@@ -242,7 +242,7 @@ struct {
struct {
const gchar *conf_file;
GSList *item_list;
-} toolbar_config[3] = {
+} toolbar_config[NUM_TOOLBARS] = {
{ "toolbar_main.xml", NULL},
{ "toolbar_compose.xml", NULL},
{ "toolbar_msgview.xml", NULL}
@@ -767,7 +767,7 @@ void toolbar_read_config_file(ToolbarType source)
else if (source == TOOLBAR_MSGVIEW)
toolbar_set_default(TOOLBAR_MSGVIEW);
else {
- g_warning("failed to write Toolbar Configuration to %s\n", toolbar_config[source].conf_file);
+ g_warning("refusing to write unknown Toolbar Configuration number %d\n", source);
return;
}
diff --git a/src/toolbar.h b/src/toolbar.h
@@ -34,6 +34,8 @@ typedef enum {
TOOLBAR_MSGVIEW
} ToolbarType;
+#define NUM_TOOLBARS 3
+
typedef enum
{
COMPOSEBUTTON_MAIL,