From 7c2a062cdf9c0514cdf32f4f8bd07cf52d183c8b Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Wed, 10 Sep 2014 19:46:34 +0200 Subject: Do not use strchr for span searches Strchr will return a valid pointer for '\0' when searching a static string, as the NULL byte is part of the string. --- src/inlines.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/inlines.c b/src/inlines.c index 3040f09..cd2d124 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -767,10 +767,13 @@ node_inl *parse_chunk_inlines(chunk *chunk, reference_map *refmap) static int subject_find_special_char(subject *subj) { + static const char CHARS[] = "\n\\`&_*[]pos + 1; while (n < subj->input.len) { - if (strchr("\n\\`&_*[]input.data[n])) + if (memchr(CHARS, subj->input.data[n], CHARS_SIZE)) return n; n++; } -- cgit v1.2.3