mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
fixed bug #381877, avoid reading over the end of stream when generating an
* HTMLparser.c: fixed bug #381877, avoid reading over the end of stream when generating an UTF-8 encoding error. Daniel svn path=/trunk/; revision=3627
This commit is contained in:
10
HTMLparser.c
10
HTMLparser.c
@ -401,9 +401,13 @@ encoding_error:
|
||||
{
|
||||
char buffer[150];
|
||||
|
||||
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
|
||||
ctxt->input->cur[0], ctxt->input->cur[1],
|
||||
ctxt->input->cur[2], ctxt->input->cur[3]);
|
||||
if (ctxt->input->end - ctxt->input->cur >= 4) {
|
||||
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
|
||||
ctxt->input->cur[0], ctxt->input->cur[1],
|
||||
ctxt->input->cur[2], ctxt->input->cur[3]);
|
||||
} else {
|
||||
snprintf(buffer, 149, "Bytes: 0x%02X\n", ctxt->input->cur[0]);
|
||||
}
|
||||
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
|
||||
"Input is not proper UTF-8, indicate encoding !\n",
|
||||
BAD_CAST buffer, NULL);
|
||||
|
Reference in New Issue
Block a user