test-expat: use zero-filled read buffer

Fix #3062
This commit is contained in:
Stefan Kalkowski 2018-11-28 13:56:11 +01:00 committed by Christian Helmuth
parent 9857a0c956
commit 41dfc51beb

View File

@ -36,7 +36,7 @@ static void end_element(void *userdata, const char *name)
int main(int argc, char *argv[])
{
char buf[128];
static char buf[128];
XML_Parser parser = XML_ParserCreate(NULL);
XML_SetElementHandler(parser, start_element, end_element);
@ -48,7 +48,7 @@ int main(int argc, char *argv[])
return -1;
}
read(config_fd, buf, sizeof(buf));
read(config_fd, buf, sizeof(buf) - 1);
if (XML_Parse(parser, buf, strlen(buf), 1) == XML_STATUS_ERROR) {
printf(" Error: %s at line %lu\n",