On Wed, Sep 30, 2026 at 10:00:04AM +0200, Alejandro Colomar via Mutt-dev wrote:
While double checking url_ciss_t usage, I noticed these two functions could be more robust about checking their parameters. --- url.c | 6 ++++++ 1 file changed, 6 insertions(+)diff --git a/url.c b/url.c index 37d091cf..a813901a 100644 --- a/url.c +++ b/url.c @@ -101,6 +101,9 @@ url_scheme_t url_check_scheme(const char *s) int url_parse_file(char *d, const char *src, size_t dl) { + if (!src || !d) + return -1; + if (ascii_strncasecmp(src, "file:", 5)) return -1; else if (!ascii_strncasecmp(src, "file://", 7)) /* we don't support remote files */ @@ -305,6 +308,9 @@ int url_parse_mailto(ENVELOPE *e, char **body, const char *src) LIST *last = NULL; + if (!src) + return -1;I tend to dislike these protections because they are often dead code that confuses the reader about what is possible, but mutt(1) is already full of them, and since it uses NULL often to mean the same as "", it might be good to add them. LGTM, I guess.
Yeah, I understand your meaning. I didn't create this patch in response to the patchset changes. It was just a reflex thought while I was in the file checking usage of url_ciss_t.
In fact, I've taken a second look at all the callers, and they appear to be guarding against NULL just fine. The parse_file() isn't actually even used!
So I think I'll just drop this change from the patchset too. Thank you for taking a look and your feedback! -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
Description: PGP signature
