From 119313e6d7ae24980a9e141a464052e8b8a14c2d Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Tue, 14 Mar 2017 17:43:03 -0400 Subject: [PATCH] FIXED: Fix edge case with URL definitions --- Sources/libMultiMarkdown/writer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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" -- 2.40.0