From 4927acf25a02c724dbc09583eec9061b875b2651 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 8 May 2013 15:34:37 -0700 Subject: [PATCH] scheduler: fix bug in copying long XML elements --- lib/parse.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/parse.cpp b/lib/parse.cpp index 53d5002cf1..1abd9b3974 100644 --- a/lib/parse.cpp +++ b/lib/parse.cpp @@ -214,14 +214,18 @@ int dup_element(FILE* in, const char* tag_name, char** pp) { int copy_element_contents(FILE* in, const char* end_tag, char* p, int len) { char buf[256]; int n; + int retval = 0; strcpy(p, ""); while (fgets(buf, 256, in)) { if (strstr(buf, end_tag)) { - return 0; + return retval; } n = (int)strlen(buf); - if (n >= len-1) return ERR_XML_PARSE; + if (n >= len-1) { + retval = ERR_XML_PARSE; + continue; + } strcat(p, buf); len -= n; }