mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Fix out-of-bound access to the quote_char buffer
The quote_level was decremented unconditionally and could become negative resulting in a negative index after applying "modulus 2". Reproducable with an HTML file contianing "</q>". Reported by paakku.
This commit is contained in:
parent
7e52d23d2f
commit
9d43babde2
@ -114,7 +114,12 @@ html_quote_close(struct html_context *html_context, unsigned char *a,
|
||||
unsigned char *xxx3, unsigned char *xxx4,
|
||||
unsigned char **xxx5)
|
||||
{
|
||||
unsigned char *q = quote_char[--html_context->quote_level % 2];
|
||||
unsigned char *q;
|
||||
|
||||
if (html_context->quote_level > 0)
|
||||
html_context->quote_level--;
|
||||
|
||||
q = quote_char[html_context->quote_level % 2];
|
||||
|
||||
put_chrs(html_context, q, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user