1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-02 02:15:28 +00:00

Make html_context.quote_level unsigned.

Continuation of 7e9fc6f33b.
This commit is contained in:
Kalle Olavi Niemitalo 2006-12-10 14:14:16 +02:00 committed by Kalle Olavi Niemitalo
parent 7db8abf6e7
commit a193632187
2 changed files with 10 additions and 1 deletions

View File

@ -66,7 +66,8 @@ struct html_context {
* state-machine. */
int was_li;
int quote_level; /* Nesting level of <q> tags. */
unsigned int quote_level; /* Nesting level of <q> tags. See @html_quote
* for why this is unsigned. */
unsigned int was_br:1;
unsigned int was_xmp:1;

View File

@ -104,6 +104,14 @@ void
html_quote(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
/* An HTML document containing extremely many repetitions of
* "<q>" could cause @html_context->quote_level to overflow.
* Because it is unsigned, it then wraps around to zero, and
* we don't get a negative array index here. If the document
* then tries to close the quotes with "</q>", @html_quote_close
* won't let the quote level wrap back, so it will render the
* quotes incorrectly, but such a document probably doesn't
* make sense anyway. */
unsigned char *q = quote_char[html_context->quote_level++ % 2];
put_chrs(html_context, q, 1);