From d32a5412112c67cd1fb726f9f101033d1748f484 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sat, 29 Sep 2018 20:31:10 -0400 Subject: [PATCH] Fix crash bug in mxmlWrite functions (Issue #228) --- CHANGES.md | 3 ++- mxml-file.c | 4 ++-- mxmldoc.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index dc489d3..acb54a7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,8 @@ - The `mxmlNewCDATA` and `mxmlSetCDATA` functions incorrectly added the XML trailer "]]" to the string (Issue #216) - Cross-compiling failed on install (Issue #218) -- Updated the ZIP container library used for mxmldoc. +- Fixed a crash bug in the `mxmlWrite` functions (Issue #228) +- Updated the markdown and ZIP container libraries used for mxmldoc. # Changes in Mini-XML 2.11 diff --git a/mxml-file.c b/mxml-file.c index 1f46892..b844bc7 100644 --- a/mxml-file.c +++ b/mxml-file.c @@ -1,7 +1,7 @@ /* * File loading code for Mini-XML, a small XML file parsing library. * - * Copyright 2003-2017 by Michael R Sweet. + * Copyright 2003-2018 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright @@ -2974,7 +2974,7 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ { while ((next = current->next) == NULL) { - if (current == node) + if (current == node || !current->parent) break; /* diff --git a/mxmldoc.c b/mxmldoc.c index ea75bf8..b65ebb3 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -3,7 +3,7 @@ * Documentation generator using Mini-XML, a small XML file parsing * library. * - * Copyright 2003-2017 by Michael R Sweet. + * Copyright 2003-2018 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright