Skip to content

Commit

Permalink
Fix handling of raw control characters in autolinked URLs
Browse files Browse the repository at this point in the history
Control characters == 2 in the escape table, don't skip by those!
  • Loading branch information
JordanMilne committed Apr 16, 2015
1 parent 0ffc96f commit 3930e3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion html/houdini_href_e.c
Expand Up @@ -62,7 +62,9 @@ houdini_escape_href(struct buf *ob, const uint8_t *src, size_t size)

while (i < size) {
org = i;
while (i < size && HREF_SAFE[src[i]] != 0)
/* Skip by characters that don't need special
* processing */
while (i < size && HREF_SAFE[src[i]] == 1)
i++;

if (i > org)
Expand Down
3 changes: 3 additions & 0 deletions test_snudown.py
Expand Up @@ -11,6 +11,9 @@
'http://www.reddit.com':
'<p><a href="http://www.reddit.com">http://www.reddit.com</a></p>\n',

'http://www.reddit.com/a\x00b':
'<p><a href="http://www.reddit.com/ab">http://www.reddit.com/ab</a></p>\n',

'[foo](http://en.wikipedia.org/wiki/Link_(film\))':
'<p><a href="http://en.wikipedia.org/wiki/Link_(film)">foo</a></p>\n',

Expand Down

0 comments on commit 3930e3a

Please sign in to comment.