Skip to content

Commit

Permalink
Improved URL scanner to properly handle domains that start with digits
Browse files Browse the repository at this point in the history
Fixes issue #152
  • Loading branch information
jstedfast committed Aug 24, 2023
1 parent 845255a commit 35fe6a8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion util/url-scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,20 @@ url_web_end (const char *in, const char *pos, const char *inend, urlmatch_t *mat

/* find the end of the domain */
if (is_digit (*inptr)) {
goto ip_literal2;
/* this is either an IP literal or it could be a subdomain that begins with a numeric character(s) */
end = inptr;
while (end < inend && is_digit (*end))
end++;

if (end < inend && *end == '.')
goto ip_literal2;

if (is_atom (*end))
goto atom;

return FALSE;
} else if (is_atom (*inptr)) {
atom:
/* might be a domain or user@domain */
save = inptr;
while (inptr < inend) {
Expand Down

0 comments on commit 35fe6a8

Please sign in to comment.