From aad2066c7a3730f8995b550cf571119eb19a5ad9 Mon Sep 17 00:00:00 2001 From: Aaron Schrab Date: Sun, 6 Oct 2013 14:32:45 +0000 Subject: [PATCH] Ensure that BUFFER variables are initialized to prevent later attempts to traverse an uninitialized pointer. --- commands.c | 1 + hook.c | 7 +++++-- imap/command.c | 1 + imap/imap.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/commands.c b/commands.c index 68cfe276b..6b23e396c 100644 --- a/commands.c +++ b/commands.c @@ -617,6 +617,7 @@ void mutt_enter_command (void) buffer[0] = 0; if (mutt_get_field (":", buffer, sizeof (buffer), M_COMMAND) != 0 || !buffer[0]) return; + mutt_buffer_init (&err); err.dsize = STRING; err.data = safe_malloc(err.dsize); mutt_buffer_init (&token); diff --git a/hook.c b/hook.c index 6e881ef54..34f310653 100644 --- a/hook.c +++ b/hook.c @@ -281,7 +281,8 @@ void mutt_folder_hook (char *path) BUFFER err, token; current_hook_type = M_FOLDERHOOK; - + + mutt_buffer_init (&err); err.dsize = STRING; err.data = safe_malloc (err.dsize); mutt_buffer_init (&token); @@ -332,7 +333,8 @@ void mutt_message_hook (CONTEXT *ctx, HEADER *hdr, int type) HOOK *hook; current_hook_type = type; - + + mutt_buffer_init (&err); err.dsize = STRING; err.data = safe_malloc (err.dsize); mutt_buffer_init (&token); @@ -476,6 +478,7 @@ void mutt_account_hook (const char* url) if (inhook) return; + mutt_buffer_init (&err); err.dsize = STRING; err.data = safe_malloc (err.dsize); mutt_buffer_init (&token); diff --git a/imap/command.c b/imap/command.c index 092cf597c..32f84178d 100644 --- a/imap/command.c +++ b/imap/command.c @@ -778,6 +778,7 @@ static void cmd_parse_lsub (IMAP_DATA* idata, char* s) url_ciss_tostring (&url, buf + 11, sizeof (buf) - 10, 0); safe_strcat (buf, sizeof (buf), "\""); mutt_buffer_init (&token); + mutt_buffer_init (&err); err.data = errstr; err.dsize = sizeof (errstr); if (mutt_parse_rc_line (buf, &token, &err)) diff --git a/imap/imap.c b/imap/imap.c index 517335724..93dc06a7f 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1828,6 +1828,7 @@ int imap_subscribe (char *path, int subscribe) if (option (OPTIMAPCHECKSUBSCRIBED)) { mutt_buffer_init (&token); + mutt_buffer_init (&err); err.data = errstr; err.dsize = sizeof (errstr); snprintf (mbox, sizeof (mbox), "%smailboxes \"%s\"", -- 2.40.0