diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-08-21 20:11:23 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-08-21 21:20:47 +0200 |
commit | 4565334dfe44863c50bdae150e85efca65f9ab18 (patch) | |
tree | 61b587ed19059244adc7843131c60d6e16dc6abc | |
parent | 64f089d0b742dc2347cf671549f31f485b0a8c41 (diff) |
xml: fix missing first byte when parsing a long incorrect attribute entity
... the entity had to be invalid (start with &) and longer than the buffer
size.
+ tiny style fix.
-rw-r--r-- | xml.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -57,11 +57,12 @@ xml_parseattrs(XMLParser *x) if (valuelen < sizeof(x->data) - 1) x->data[valuelen++] = c; else { - /* TODO: entity too long? this should be very strange. */ + /* entity too long for buffer, handle as normal data */ x->data[valuelen] = '\0'; if (x->xmlattr) x->xmlattr(x, x->tag, x->taglen, x->name, namelen, x->data, valuelen); - valuelen = 0; + x->data[0] = c; + valuelen = 1; break; } if (c == ';') { @@ -100,8 +101,8 @@ xml_parseattrs(XMLParser *x) break; } else if (c == '/') { x->isshorttag = 1; - namelen = 0; x->name[0] = '\0'; + namelen = 0; } } } |