summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-08-05 00:01:34 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-08-05 00:01:34 +0300
commit1274d937868d1cade86de7fca3a32b94595374dc (patch)
tree28df89406ea776c52372a3ca416ed6cefa0084be
parent2d11001569912744ff85c0eada305859c209aded (diff)
downloadmailutils-1274d937868d1cade86de7fca3a32b94595374dc.tar.gz
mailutils-1274d937868d1cade86de7fca3a32b94595374dc.tar.bz2
Assorted fixes
* libmailutils/mailbox/body.c (mu_body_size): Don't unref the transport stream. This fixes a bug introduced in 45d54031f4. * decodemail/decodemail.c (message_decode): Additional error-checking. * libmailutils/cfg/parser.y (split_cfg_path): Free the mu_wordsplit object on error. * libmu_sieve/extensions/spamd.c (spamd_read_line): Fix the argument to free. * doc/texinfo/programs/decodemail.texi: Remove a techically incorrect passage. * examples/sa.c: Initialize the urlstr variable. * libmailutils/base/amd.c (amd_msg_lookup): Store the value in *pret only if returning success. (amd_body_stream_seek): Check the return value from amd_body_size. * libmailutils/base/permstr.c (mu_readlink): Fix the uninitialized variable. * libmailutils/base/symlink.c (mu_readlink) Store the value in *plen only on success.
-rw-r--r--decodemail/decodemail.c10
-rw-r--r--doc/texinfo/programs/decodemail.texi4
-rw-r--r--examples/sa.c2
-rw-r--r--libmailutils/base/amd.c8
-rw-r--r--libmailutils/base/permstr.c2
-rw-r--r--libmailutils/base/symlink.c5
-rw-r--r--libmailutils/cfg/parser.y1
-rw-r--r--libmailutils/mailbox/body.c3
-rw-r--r--libmu_sieve/extensions/spamd.c2
-rw-r--r--paths2
10 files changed, 25 insertions, 14 deletions
diff --git a/decodemail/decodemail.c b/decodemail/decodemail.c
index 319a91651..aa73cdc2f 100644
--- a/decodemail/decodemail.c
+++ b/decodemail/decodemail.c
@@ -649,7 +649,15 @@ message_decode (mu_message_t msg, mu_coord_t *crd, size_t dim)
mu_mime_create_multipart (&mime, ct->subtype, ct->param);
mu_content_type_destroy (&ct);
- mu_message_get_num_parts (msg, &nparts);
+ rc = mu_message_get_num_parts (msg, &nparts);
+ if (rc)
+ {
+ crd_error (*crd, dim, "mu_message_get_num_parts(%s): %s",
+ MU_HEADER_CONTENT_TYPE, mu_strerror (rc));
+ --dim;
+ mu_message_ref (msg);
+ return msg;
+ }
for (i = 1; i <= nparts; i++)
{
diff --git a/doc/texinfo/programs/decodemail.texi b/doc/texinfo/programs/decodemail.texi
index 1b4d9f0f2..0267124fb 100644
--- a/doc/texinfo/programs/decodemail.texi
+++ b/doc/texinfo/programs/decodemail.texi
@@ -14,9 +14,7 @@ the output, regardless of whether a change was made.
The message parts deemed to be textual are those whose
@samp{Content-Type} header matches a predefined, or user-defined,
mime type pattern. In addition, encoded pieces of the @samp{From:},
-@samp{To:}, @samp{Subject:}, etc., headers are decoded. A non-mime
-message which has a textual content type and is encoded in base64 or
-quoted-printable is likewise decoded.
+@samp{To:}, @samp{Subject:}, etc., headers are decoded.
For example, @command{decodemail} makes this transformation:
diff --git a/examples/sa.c b/examples/sa.c
index 9c953429f..4683413fd 100644
--- a/examples/sa.c
+++ b/examples/sa.c
@@ -26,7 +26,7 @@ main (int argc, char **argv)
struct mu_sockaddr *sa, *ap;
int rc, i;
char *node = NULL, *serv = NULL;
- char *urlstr;
+ char *urlstr = NULL;
mu_set_program_name (argv[0]);
diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c
index a4e9daf49..115f9e73d 100644
--- a/libmailutils/base/amd.c
+++ b/libmailutils/base/amd.c
@@ -321,7 +321,8 @@ amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg,
}
rc = amd_msg_bsearch (amd, 0, amd->msg_count - 1, msg, &i);
- *pret = i + 1;
+ if (rc == 0)
+ *pret = i + 1;
return rc;
}
@@ -1979,10 +1980,13 @@ amd_body_stream_readdelim (mu_stream_t is, char *buffer, size_t buflen,
static int
amd_body_stream_seek (mu_stream_t str, mu_off_t off, mu_off_t *presult)
{
+ int rc;
size_t size;
struct _amd_body_stream *amdstr = (struct _amd_body_stream *)str;
- amd_body_size (amdstr->body, &size);
+ rc = amd_body_size (amdstr->body, &size);
+ if (rc)
+ return rc;
if (off < 0 || off > size)
return ESPIPE;
diff --git a/libmailutils/base/permstr.c b/libmailutils/base/permstr.c
index 602b98323..c838734c5 100644
--- a/libmailutils/base/permstr.c
+++ b/libmailutils/base/permstr.c
@@ -80,7 +80,7 @@ int
mu_parse_stream_perm_string (int *pmode, const char *str, const char **endp)
{
int mode = 0;
- int f;
+ int f = 0;
while (*str)
{
switch (*str)
diff --git a/libmailutils/base/symlink.c b/libmailutils/base/symlink.c
index 5cbe90519..b90533c65 100644
--- a/libmailutils/base/symlink.c
+++ b/libmailutils/base/symlink.c
@@ -91,10 +91,11 @@ mu_readlink (const char *name, char **pbuf, size_t *psize, size_t *plen)
}
size = 0;
}
+ else if (plen)
+ *plen = linklen;
+
*pbuf = buf;
*psize = size;
- if (plen)
- *plen = linklen;
return status;
}
diff --git a/libmailutils/cfg/parser.y b/libmailutils/cfg/parser.y
index 71272f665..ce05b3865 100644
--- a/libmailutils/cfg/parser.y
+++ b/libmailutils/cfg/parser.y
@@ -1293,6 +1293,7 @@ split_cfg_path (const char *path, int *pargc, char ***pargv)
{
mu_error (_("cannot split line `%s': %s"), path,
mu_wordsplit_strerror (&ws));
+ mu_wordsplit_free (&ws);
return errno;
}
argc = ws.ws_wordc;
diff --git a/libmailutils/mailbox/body.c b/libmailutils/mailbox/body.c
index 97f60fa22..7619d4dd7 100644
--- a/libmailutils/mailbox/body.c
+++ b/libmailutils/mailbox/body.c
@@ -357,12 +357,11 @@ mu_body_size (mu_body_t body, size_t *psize)
return MU_ERR_OUT_PTR_NULL;
if (body->_size)
return body->_size (body, psize);
- /* Fall on the stream. */
+ /* Fall back on the transport stream. */
rc = body_get_transport (body, BODY_RDONLY, &str);
if (rc)
return rc;
rc = mu_stream_size (str, &s);
- mu_stream_unref (str);
*psize = s;
return 0;
}
diff --git a/libmu_sieve/extensions/spamd.c b/libmu_sieve/extensions/spamd.c
index a6260731e..504f75c9f 100644
--- a/libmu_sieve/extensions/spamd.c
+++ b/libmu_sieve/extensions/spamd.c
@@ -254,7 +254,7 @@ spamd_read_line (mu_sieve_machine_t mach, mu_stream_t stream,
/* FIXME: Need an 'onabort' mechanism in Sieve machine, which
would restore the things to their prior state. This will
also allow to make handler local again. */
- free (pbuffer);
+ free (*pbuffer);
mu_sieve_error (mach, "read error: %s", mu_strerror (rc));
spamd_abort (mach, &stream, handler);
}
diff --git a/paths b/paths
index 3ad32a689..0f2598fdd 100644
--- a/paths
+++ b/paths
@@ -35,7 +35,7 @@
# d -- The same as test:d
# c -- The same as test:c
# b -- The same as test:b
-# <ach.h>:SYMBOL
+# <ack.h>:SYMBOL
# -- If SYMBOL is defined in <ack.h>, use SYM
# <ack.h> -- The same as <ack.h>:_PATH_FOO
# search:NAME:PATH

Return to:

Send suggestions and report system problems to the System administrator.