sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit 77606ed0b26aa364dd53b1b9689ff3fd8f0489f3
parent 0c1cbd4701b8a2e4d6f792f393bac3e3d04579b6
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed, 22 Aug 2018 16:03:52 +0200

xml: improve handling of invalid long data entities

this also fixes an issue with truncating and missing data on invalid input.

Diffstat:
Mxml.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xml.c b/xml.c @@ -416,9 +416,16 @@ xml_parse(XMLParser *x) break; if (datalen < sizeof(x->data) - 1) x->data[datalen++] = c; - if (isspace(c)) + else { + /* entity too long for buffer, handle as normal data */ + x->data[datalen] = '\0'; + if (x->xmldata) + x->xmldata(x, x->data, datalen); + x->data[0] = c; + datalen = 1; break; - else if (c == ';') { + } + if (c == ';') { x->data[datalen] = '\0'; if (x->xmldataentity) x->xmldataentity(x, x->data, datalen);