Hi Kevin,

> Date: 2026-09-30 12:45:47+0800
> From: "Kevin J. McCarthy" <[email protected]>
>
> 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.


Cheers,
Alex

> +
>    if (!(t = strchr(src, ':')))
>      return -1;
>  
> -- 
> 2.55.0
> 

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to