Mercurial > hg > octave-shane > gnulib-hg
changeset 17507:9aea01bed17e
pmccabe2html: escaping of special characters
The C code characters '<', '>', and '&' were improperly
escaped in HTML output, and their multiplicity was ignored.
author | Mats Erik Andersson <gnu@gisladisker.se> |
---|---|
date | Wed, 25 Sep 2013 22:27:03 +0200 |
parents | 02ceb05fbd04 |
children | 52cc408447aa |
files | ChangeLog build-aux/pmccabe2html |
diffstat | 2 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-09-25 Mats Erik Andersson <gnu@gisladisker.se> + + pmccabe2html: escaping of special characters + Escape all '<', '>', and '&' in HTML output. + * build-aux/pmccabe2html (html_fnc): Call gsub() + instead of sub() to capture all '<', '>', and '&'. + Neither of '<' and '>' is special in a regexp, + so first arguments to gsub() are corrected. Also, + in replacement strings, ampersand must be escaped. + Finally, '&' must be handled first, then '<' and '>'. + 2013-09-24 Eric Blake <eblake@redhat.com> manywarnings: enable nicer gcc warning messages
--- a/build-aux/pmccabe2html +++ b/build-aux/pmccabe2html @@ -422,9 +422,9 @@ while ((getline codeline < (fname nfun "_fn.txt")) > 0) { - sub(/\\</, "<", codeline) - sub(/\\>/, ">", codeline) - sub(/&/, "&", codeline) + gsub(/&/, "\&", codeline) # Must come first. + gsub(/</, "\<", codeline) + gsub(/>/, "\>", codeline) print codeline }