From: Fletcher T. Penney Date: Tue, 14 Mar 2017 21:43:03 +0000 (-0400) Subject: FIXED: Fix edge case with URL definitions X-Git-Tag: 6.0.0-rc1^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=119313e6d7ae24980a9e141a464052e8b8a14c2d;p=multimarkdown FIXED: Fix edge case with URL definitions --- diff --git a/Sources/libMultiMarkdown/writer.c b/Sources/libMultiMarkdown/writer.c index 7aa4bff..69261b3 100644 --- a/Sources/libMultiMarkdown/writer.c +++ b/Sources/libMultiMarkdown/writer.c @@ -851,12 +851,15 @@ char * destination_accept(const char * source, token ** remainder, bool validate // Grab destination string url = my_strndup(&source[start], scan_len); - // Advance remainder - while ((*remainder)->start < start + scan_len) + // Advance remainder to end of destination + while ((*remainder)->next && + (*remainder)->next->start < start + scan_len) { *remainder = (*remainder)->next; + } - - t = (*remainder)->prev; + t = (*remainder); // We need to remember this for below + // Move remainder beyond destination + *remainder = (*remainder)->next; // Is there a space in a URL concatenated with a title or attribute? // e.g. [foo]: http://foo.bar/ class="foo"