* [PATCH 1/3] Fix double free in guess_from_received_header().
@ 2011-06-15 11:12 Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 2/3] Fix memory leak " Dmitry Kurochkin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Kurochkin @ 2011-06-15 11:12 UTC (permalink / raw)
To: notmuch
Before the change, the last loop in guess_from_received_header()
did not reset domain and tld variables to NULL. This leads to
double free error in some cases and possibly other bugs.
---
notmuch-reply.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 514bbc6..dab69e6 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -406,6 +406,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
/* Now extract the last two components of the MTA host name
* as domain and tld.
*/
+ domain = tld = NULL;
while ((ptr = strsep (&token, delim)) != NULL) {
if (*ptr == '\0')
continue;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Fix memory leak in guess_from_received_header().
2011-06-15 11:12 [PATCH 1/3] Fix double free in guess_from_received_header() Dmitry Kurochkin
@ 2011-06-15 11:12 ` Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 3/3] Fix indentation " Dmitry Kurochkin
2011-06-15 14:08 ` [PATCH 1/3] Fix double free " Carl Worth
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Kurochkin @ 2011-06-15 11:12 UTC (permalink / raw)
To: notmuch
Mta variable was not free()d in one case.
---
notmuch-reply.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index dab69e6..64f70bf 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -401,8 +401,10 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
break;
mta = xstrdup (by);
token = strtok(mta," \t");
- if (token == NULL)
+ if (token == NULL) {
+ free (mta);
break;
+ }
/* Now extract the last two components of the MTA host name
* as domain and tld.
*/
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Fix indentation in guess_from_received_header().
2011-06-15 11:12 [PATCH 1/3] Fix double free in guess_from_received_header() Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 2/3] Fix memory leak " Dmitry Kurochkin
@ 2011-06-15 11:12 ` Dmitry Kurochkin
2011-06-15 14:08 ` [PATCH 1/3] Fix double free " Carl Worth
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Kurochkin @ 2011-06-15 11:12 UTC (permalink / raw)
To: notmuch
---
notmuch-reply.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 64f70bf..27ef37b 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -427,13 +427,13 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
if (strcasestr(primary, domain)) {
free(mta);
- return primary;
- }
- for (i = 0; i < other_len; i++)
- if (strcasestr (other[i],domain)) {
- free(mta);
- return other[i];
+ return primary;
}
+ for (i = 0; i < other_len; i++)
+ if (strcasestr (other[i],domain)) {
+ free(mta);
+ return other[i];
+ }
}
free (mta);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] Fix double free in guess_from_received_header().
2011-06-15 11:12 [PATCH 1/3] Fix double free in guess_from_received_header() Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 2/3] Fix memory leak " Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 3/3] Fix indentation " Dmitry Kurochkin
@ 2011-06-15 14:08 ` Carl Worth
2 siblings, 0 replies; 4+ messages in thread
From: Carl Worth @ 2011-06-15 14:08 UTC (permalink / raw)
To: Dmitry Kurochkin, notmuch
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
On Wed, 15 Jun 2011 15:12:12 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> Before the change, the last loop in guess_from_received_header()
> did not reset domain and tld variables to NULL. This leads to
> double free error in some cases and possibly other bugs.
Thanks for the fixes. These are all pushed now.
-Carl
--
carl.d.worth@intel.com
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-15 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 11:12 [PATCH 1/3] Fix double free in guess_from_received_header() Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 2/3] Fix memory leak " Dmitry Kurochkin
2011-06-15 11:12 ` [PATCH 3/3] Fix indentation " Dmitry Kurochkin
2011-06-15 14:08 ` [PATCH 1/3] Fix double free " Carl Worth
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).