* BUG: Fixed a memory leak when using XmlDocument.Save()
* BUG: Fix the un-escape parsing method, it don't crash anymore if there the parsed string is less than 3 bytes length.

git-svn-id: svn://localhost/gambas/trunk@4988 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2012-07-25 11:07:38 +00:00
parent d0069fd324
commit 24f0205b30
2 changed files with 2 additions and 1 deletions

View file

@ -248,6 +248,7 @@ void Document::save(const char *fileName, bool indent)
fputs(data, newFile);
fclose(newFile);
free(data);
}

View file

@ -99,7 +99,7 @@ void TextNode::unEscapeContent(const char *src, const size_t lenSrc, char *&dst,
memcpy(dst, src, lenSrc);
char *posFound = (char*)memchr(dst, CHAR_AND, lenDst);
while(posFound != 0)
while(posFound != 0 && (posFound + 3) < lenDst + dst);//(posFound - dst) < lenDst - 3
{
if(memcmp(posFound + 1, "lt;", 3) == 0)// < &lt;
{