1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

apply fixes to close #63271 and avoid segfaults when the error routine

* parser.c globals.c DOCBparser.c HTMLparser.c error.c:
  apply fixes to close #63271 and avoid segfaults when
  the error routine gets callbed before xmlInitParser()
  get called.
* nanoftp.c error.c: Applied patches from Justin Fletcher
  correcting some xmlGenericError misuses.
Daniel
This commit is contained in:
Daniel Veillard
2001-10-29 11:48:19 +00:00
parent 5109531755
commit 635ef72a94
7 changed files with 40 additions and 21 deletions

14
error.c
View File

@ -14,6 +14,10 @@
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
const char *msg,
...);
#define XML_GET_VAR_STR(msg, str) { \
int size; \
int chars; \
@ -58,7 +62,7 @@
*
* Default handler for out of context error messages.
*/
static void
void
xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_list args;
@ -261,7 +265,7 @@ xmlParserError(void *ctx, const char *msg, ...)
xmlGenericError(xmlGenericErrorContext, "error: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
@ -304,7 +308,7 @@ xmlParserWarning(void *ctx, const char *msg, ...)
xmlGenericError(xmlGenericErrorContext, "warning: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
@ -350,7 +354,7 @@ xmlParserValidityError(void *ctx, const char *msg, ...)
xmlGenericError(xmlGenericErrorContext, "validity error: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);
@ -385,7 +389,7 @@ xmlParserValidityWarning(void *ctx, const char *msg, ...)
xmlGenericError(xmlGenericErrorContext, "validity warning: ");
XML_GET_VAR_STR(msg, str);
xmlGenericError(xmlGenericErrorContext, str);
xmlGenericError(xmlGenericErrorContext, "%s", str);
if (str != NULL)
xmlFree(str);