summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-12-30 09:35:30 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-12-30 09:35:30 +0200
commit139d323eea2e95523aa75f2664330210da5112d3 (patch)
tree33e1aad863fd1ea94c396f02e35550999e2ba444
parent69f10b38b0f7aaef7a6c1aa1ed880e0eb1647204 (diff)
downloadmailutils-139d323eea2e95523aa75f2664330210da5112d3.tar.gz
mailutils-139d323eea2e95523aa75f2664330210da5112d3.tar.bz2
Fix coredump on NULL input to mu_url_create_hint
In particular, this caused inc to coredump when called without explicit -file option. * libmailutils/url/create.c (mu_url_create_hint): Return EINVAL if str is NULL. * mh/tests/inc.at: Add new test.
-rw-r--r--libmailutils/url/create.c2
-rw-r--r--mh/tests/inc.at15
2 files changed, 16 insertions, 1 deletions
diff --git a/libmailutils/url/create.c b/libmailutils/url/create.c
index a7e98414e..e9284da59 100644
--- a/libmailutils/url/create.c
+++ b/libmailutils/url/create.c
@@ -562,7 +562,7 @@ mu_url_create_hint (mu_url_t *purl, const char *str, int flags,
struct mu_url_ctx ctx;
mu_url_t url;
- if (!purl)
+ if (!purl || !str)
return EINVAL;
url = calloc (1, sizeof (*url));
if (url == NULL)
diff --git a/mh/tests/inc.at b/mh/tests/inc.at
index 45bfe1161..a53c36de2 100644
--- a/mh/tests/inc.at
+++ b/mh/tests/inc.at
@@ -107,5 +107,20 @@ inc -changecur -file ./mbox1 | sed 's/ *$//'
25 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
])
+MH_CHECK([default inbox],[inc06 inc-default],[
+cat $abs_top_srcdir/testsuite/spool/mbox1 > inputmail
+mkdir Mail/inbox
+FOLDER=$(pwd)/inputmail
+export FOLDER
+inc | sed 's/ *$//'
+],
+[0],
+[ 1+ 12/28 Foo Bar Jabberwocky<<`Twas brillig, and the slithy toves
+ 2 12/28 Bar Re: Jabberwocky<<It seems very pretty, but it's
+ 3 07/13 Sergey Poznyakoff Simple MIME<<------- =_aaaaaaaaaa0 Content-Type:
+ 4 07/13 Sergey Poznyakoff Nested MIME<<------- =_aaaaaaaaaa0 Content-Type:
+ 5 07/13 Sergey Poznyakoff Empty MIME Parts<<------- =_aaaaaaaaaa0 Content-
+])
+
m4_popdef[MH_KEYWORDS])
# End of inc.at

Return to:

Send suggestions and report system problems to the System administrator.