fix a regression in parsing when a link contains () + minor style fix - smu - smu - simple markup (Markdown) processor (fork, fixes + features) (HTM) git clone git://git.codemadness.org/smu (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 0c366f57600669cba8cff413d080f58304073a3f (DIR) parent 743f6ce00b472c6e7694b5d3c02eb73cbccaf223 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Tue, 11 May 2021 17:44:08 +0200 fix a regression in parsing when a link contains () + minor style fix Diffstat: M smu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- (DIR) diff --git a/smu.c b/smu.c @@ -33,8 +33,8 @@ static int doshortlink(const char *begin, const char *end, int newblock); /* Par static int dosurround(const char *begin, const char *end, int newblock); /* Parser for surrounding tags */ static int dounderline(const char *begin, const char *end, int newblock); /* Parser for underline tags */ static void *ereallocz(void *p, size_t size); -static void hprint(const char *begin, const char *end); /* escapes HTML and prints it to output */ -static void hprintattr(const char *begin, const char *end); /* escapes HTML for attributes and prints it to output */ +static void hprint(const char *begin, const char *end); /* Escapes HTML and prints it to output */ +static void hprintattr(const char *begin, const char *end); /* Escapes HTML for attributes and prints it to output */ static void process(const char *begin, const char *end, int isblock); /* Processes range between begin and end. */ /* list of parsers */ @@ -298,15 +298,15 @@ dolink(const char *begin, const char *end, int newblock) linkend--; } else { /* trim leading spaces */ - for (p = link; p < end && isspace((unsigned char)*p); p++) + for (p = link; p < q && isspace((unsigned char)*p); p++) ; - for (link = p; p < end; p++) { + for (link = p; p < q; p++) { if (isspace((unsigned char)*p)) { linkend = p; break; } } - for (; p < end; p++) { + for (; p < q; p++) { if (isspace((unsigned char)*p)) continue; if (*p == '=') { @@ -320,8 +320,8 @@ dolink(const char *begin, const char *end, int newblock) sep = *p; title = ++p; if ((titleend = strchr(title, sep))) { - if (titleend >= end) - titleend = end; + if (titleend >= q) + titleend = q; else p = titleend; }