Bugfix
* libproto/imap/mbox.c (imap_envelope_sender): Bugfix. Address was freed before using its member.
Showing
1 changed file
with
5 additions
and
4 deletions
... | @@ -1453,7 +1453,7 @@ imap_envelope_sender (mu_envelope_t envelope, char *buffer, size_t buflen, | ... | @@ -1453,7 +1453,7 @@ imap_envelope_sender (mu_envelope_t envelope, char *buffer, size_t buflen, |
1453 | { | 1453 | { |
1454 | mu_message_t msg = mu_envelope_get_owner (envelope); | 1454 | mu_message_t msg = mu_envelope_get_owner (envelope); |
1455 | mu_header_t header; | 1455 | mu_header_t header; |
1456 | const char *sender, *email = NULL; | 1456 | const char *sender; |
1457 | int status; | 1457 | int status; |
1458 | 1458 | ||
1459 | mu_message_get_header (msg, &header); | 1459 | mu_message_get_header (msg, &header); |
... | @@ -1464,18 +1464,19 @@ imap_envelope_sender (mu_envelope_t envelope, char *buffer, size_t buflen, | ... | @@ -1464,18 +1464,19 @@ imap_envelope_sender (mu_envelope_t envelope, char *buffer, size_t buflen, |
1464 | status = mu_header_sget_value (header, MU_HEADER_FROM, &sender); | 1464 | status = mu_header_sget_value (header, MU_HEADER_FROM, &sender); |
1465 | if (status == 0) | 1465 | if (status == 0) |
1466 | { | 1466 | { |
1467 | const char *email = NULL; | ||
1467 | size_t len; | 1468 | size_t len; |
1468 | mu_address_t address; | 1469 | mu_address_t address; |
1469 | if (mu_address_create (&address, sender) == 0) | 1470 | if (mu_address_create (&address, sender) == 0) |
1470 | { | 1471 | { |
1471 | mu_address_sget_email (address, 1, &email); | 1472 | if (mu_address_sget_email (address, 1, &email) == 0) |
1473 | len = mu_cpystr (buffer, email, buflen); | ||
1472 | mu_address_destroy (&address); | 1474 | mu_address_destroy (&address); |
1473 | } | 1475 | } |
1474 | 1476 | ||
1475 | if (!email) | 1477 | if (!email) |
1476 | return MU_ERR_NOENT; | 1478 | return MU_ERR_NOENT; |
1477 | 1479 | ||
1478 | len = mu_cpystr (buffer, email, buflen); | ||
1479 | if (plen) | 1480 | if (plen) |
1480 | *plen = len; | 1481 | *plen = len; |
1481 | } | 1482 | } | ... | ... |
-
Please register or sign in to post a comment