diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-04-08 15:24:16 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-04-08 15:24:16 +0200 |
commit | 4959de9c170b3d2d8dee622d50d0fae70ec5b463 (patch) | |
tree | f922d19558f11c5eabddf71a286ca83b7409c5bf | |
parent | 7a31e4fcdca0f2f82e9fea143dc157607a811ccf (diff) |
sfeed: fix entity conversion
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rw-r--r-- | sfeed.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -151,6 +151,7 @@ namedentitytostr(const char *e, char *buffer, size_t bufsiz) { { NULL, NULL } }; size_t i; + if(*e != '&' || bufsiz < 2) /* doesn't start with & */ return 0; for(i = 0; entities[i][0]; i++) { @@ -167,10 +168,10 @@ namedentitytostr(const char *e, char *buffer, size_t bufsiz) { static int entitytostr(const char *e, char *buffer, size_t bufsiz) { unsigned long l = 0, cp = 0; + if(*e != '&' || bufsiz < 5) /* doesnt start with & */ return 0; - e++; - if(*e == '#') { + if(*(e+1) == '#') { e++; if(*e == 'x') { e++; @@ -582,7 +583,7 @@ xml_handler_data_entity(XMLParser *p, const char *data, size_t datalen) { char buffer[16]; size_t len; - /* TODO: for content HTML data entities, convert & to &? */ + /* TODO: for content HTML data entities, convert & to & ? */ if((len = entitytostr(data, buffer, sizeof(buffer)))) xml_handler_data(p, buffer, len); else |