#2968: "mailto:" URL parsing stops at "references" header
The following command line: mutt 'mailto:[EMAIL PROTECTED]&References=%3c153185.7884%40example.org%3e&[EMAIL PROTECTED]' does not take into account the given "From" header. More generally, any header (or body) that is put after the "References" header is ignored. For example, mutt 'mailto:[EMAIL PROTECTED]@example.net'&References=%3c153185.7884%40example.org%3e&Subject=subj &[EMAIL PROTECTED] will take into account the "From" header, but neither the "Subject", nor the "Reply-To". That is because in this situation mutt uses the non-reentrant strtok in a nested way. More precisely: - "mailto:" URL parsing happens in function url_parse_mailto (file url.c). - that function calls strtok once with 'headers' as first argument and then with 'NULL' as first argument, to continue advancing in the same string. - but if the header being parsed is "References" (that is 'tag' is that string), then mutt_parse_rfc822_line (which finished the for loop) (file parse.c) will call mutt_parse_references, which will in turn call strtok() with a non-NULL first argument. (And then with NULL argument until it returns NULL.) - when the for loop in url_parse_mailto proceeds, the strtok(NULL,...) call proceeds on the string passed by mutt_parse_references, but it is already at its end, and returns NULL, terminating that function. The attached patch changes all calls to strtok to the reentrant strtok_r, fixing that problem. If strtok_r is not available on all platforms, I suggest you just ship a private copy of the one in the GNU libc (or a BSD libc); mutt being GPL, this is AFAIK permitted. -- Ticket URL: <http://dev.mutt.org/trac/ticket/2968>