mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Make html_context.quote_level unsigned.
Continuation of 7e9fc6f33b33e076d16a1b02ab011df92e2641a8.
This commit is contained in:
parent
7db8abf6e7
commit
a193632187
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user