X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fhtml-parse.c;h=9fafd8f5a1177c02c455615ea7f3dfc5f37d493d;hp=692e0de4b8c463d0eaa36bd4d3d34f7f42147f41;hb=2f6aa1d7417df1dfc58597777686fbd77179b9fd;hpb=2e2ac6ad2fc90eaf46ae5fee0bc4f61dd97b4284 diff --git a/src/html-parse.c b/src/html-parse.c index 692e0de4..9fafd8f5 100644 --- a/src/html-parse.c +++ b/src/html-parse.c @@ -1,6 +1,6 @@ /* HTML parser for Wget. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008 Free Software Foundation, Inc. + 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -528,13 +528,14 @@ convert_and_copy (struct pool *pool, const char *beg, const char *end, int flags * whitespace * 8-bit and control chars * characters that clearly cannot be part of name: - '=', '>', '/'. + '=', '<', '>', '/'. This only affects attribute and tag names; attribute values allow an even greater variety of characters. */ #define NAME_CHAR_P(x) ((x) > 32 && (x) < 127 \ - && (x) != '=' && (x) != '>' && (x) != '/') + && (x) != '=' && (x) != '<' && (x) != '>' \ + && (x) != '/') #ifdef STANDALONE static int comment_backout_count; @@ -619,6 +620,7 @@ advance_declaration (const char *beg, const char *end) case '\n': ch = *p++; break; + case '<': case '>': state = AC_S_DONE; break; @@ -926,7 +928,7 @@ map_html_tags (const char *text, int size, } } - if (end_tag && *p != '>') + if (end_tag && *p != '>' && *p != '<') goto backout_tag; if (!name_allowed (allowed_tags, tag_name_begin, tag_name_end)) @@ -958,12 +960,12 @@ map_html_tags (const char *text, int size, /* ^ */ ADVANCE (p); SKIP_WS (p); - if (*p != '>') + if (*p != '<' && *p != '>') goto backout_tag; } /* Check for end of tag definition. */ - if (*p == '>') + if (*p == '<' || *p == '>') break; /* Establish bounds of attribute name. */ @@ -978,7 +980,8 @@ map_html_tags (const char *text, int size, /* Establish bounds of attribute value. */ SKIP_WS (p); - if (NAME_CHAR_P (*p) || *p == '/' || *p == '>') + + if (NAME_CHAR_P (*p) || *p == '/' || *p == '<' || *p == '>') { /* Minimized attribute syntax allows `=' to be omitted. For example,