diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-08-05 00:01:34 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-08-05 00:01:34 +0300 |
commit | 1274d937868d1cade86de7fca3a32b94595374dc (patch) | |
tree | 28df89406ea776c52372a3ca416ed6cefa0084be /libmailutils | |
parent | 2d11001569912744ff85c0eada305859c209aded (diff) | |
download | mailutils-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.
Diffstat (limited to 'libmailutils')
-rw-r--r-- | libmailutils/base/amd.c | 8 | ||||
-rw-r--r-- | libmailutils/base/permstr.c | 2 | ||||
-rw-r--r-- | libmailutils/base/symlink.c | 5 | ||||
-rw-r--r-- | libmailutils/cfg/parser.y | 1 | ||||
-rw-r--r-- | libmailutils/mailbox/body.c | 3 |
5 files changed, 12 insertions, 7 deletions
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; } |