From 91ed017ca773e14d128d4a8c0edb8654b333214e Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 14 Dec 2018 12:49:00 +0100 Subject: sfeed: rename buffer to buf, change entitytostr check, it can never happen --- sfeed.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sfeed.c b/sfeed.c index 41fee96..c9de992 100644 --- a/sfeed.c +++ b/sfeed.c @@ -641,7 +641,7 @@ xml_handler_data(XMLParser *p, const char *s, size_t len) static void xml_handler_data_entity(XMLParser *p, const char *data, size_t datalen) { - char buffer[16]; + char buf[16]; ssize_t len; if (!ctx.field) @@ -649,13 +649,8 @@ xml_handler_data_entity(XMLParser *p, const char *data, size_t datalen) /* try to translate entity, else just pass as data to * xml_data_handler. */ - len = xml_entitytostr(data, buffer, sizeof(buffer)); - /* this should never happen (buffer too small) */ - if (len < 0) - return; - - if (len > 0) - xml_handler_data(p, buffer, (size_t)len); + if ((len = xml_entitytostr(data, buf, sizeof(buf))) > 0) + xml_handler_data(p, buf, (size_t)len); else xml_handler_data(p, data, datalen); } -- cgit v1.2.3