From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id e48423ce for ; Mon, 28 May 2018 09:14:06 -0500 (EST) Date: Mon, 28 May 2018 09:14:06 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: URL-fragment strings can only contain certain characters. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-Id: Log Message: ----------- URL-fragment strings can only contain certain characters. Fixing HTML syntax violations e.g. in pf.conf(5) and ifconfig(8) reported by Anton Lazarov . Modified Files: -------------- mandoc: html.c Revision Data ------------- Index: html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.c,v retrieving revision 1.229 retrieving revision 1.230 diff -Lhtml.c -Lhtml.c -u -p -r1.229 -r1.230 --- html.c +++ html.c @@ -287,10 +287,16 @@ html_make_id(const struct roff_node *n, if (buf == NULL) return NULL; - /* http://www.w3.org/TR/html5/dom.html#the-id-attribute */ + /* + * In ID attributes, only use ASCII characters that are + * permitted in URL-fragment strings according to the + * explicit list at: + * https://url.spec.whatwg.org/#url-fragment-string + */ for (cp = buf; *cp != '\0'; cp++) - if (*cp == ' ') + if (isalnum((unsigned char)*cp) == 0 && + strchr("!$&'()*+,-./:;=?@_~", *cp) == NULL) *cp = '_'; if (unique == 0) -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv