Check for NULL before parsing purge request (needed for expat < 2.0). Fixes crash...
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 28 Jun 2010 18:54:19 +0000 (18:54 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 28 Jun 2010 18:54:19 +0000 (18:54 +0000)
org.glite.lb.common/src/xml_parse.c.T

index 797c9e6..c17d35e 100644 (file)
@@ -1982,6 +1982,9 @@ edg_wll_ErrorCode edg_wll_ParsePurgeResult(edg_wll_Context ctx, char *messageBod
        edg_wll_ErrorCode errorCode;
        XML_Char *encoding = "ISO-8859-1";
 
+       if (!messageBody)
+               return edg_wll_SetError(ctx, EDG_WLL_ERROR_XML_PARSE, "Parse error: empty response");
+
        errno = 0;
        edg_wll_ResetError(ctx);
        edg_wll_initXMLCtx(&XMLCtx);
@@ -2052,6 +2055,9 @@ edg_wll_ErrorCode edg_wll_ParseDumpResult(edg_wll_Context ctx, char *messageBody
        edg_wll_ErrorCode errorCode;
        XML_Char *encoding = "ISO-8859-1";
 
+       if (!messageBody)
+               return edg_wll_SetError(ctx, EDG_WLL_ERROR_XML_PARSE, "Parse error: empty response");
+
        errno = 0;
        edg_wll_ResetError(ctx);
        edg_wll_initXMLCtx(&XMLCtx);
@@ -2114,6 +2120,9 @@ edg_wll_ErrorCode edg_wll_ParseLoadResult(edg_wll_Context ctx, char *messageBody
        edg_wll_ErrorCode errorCode;
        XML_Char *encoding = "ISO-8859-1";
 
+       if (!messageBody)
+               return edg_wll_SetError(ctx, EDG_WLL_ERROR_XML_PARSE, "Parse error: empty response");
+
        errno = 0;
        edg_wll_ResetError(ctx);
        edg_wll_initXMLCtx(&XMLCtx);
@@ -2250,6 +2259,9 @@ edg_wll_ErrorCode edg_wll_ParseNotifResult(edg_wll_Context ctx, char *messageBod
        edg_wll_ErrorCode errorCode;
        XML_Char *encoding = "ISO-8859-1";
 
+       if (!messageBody)
+               return edg_wll_SetError(ctx, EDG_WLL_ERROR_XML_PARSE, "Parse error: empty response");
+
        errno = 0;
        edg_wll_ResetError(ctx);
        edg_wll_initXMLCtx(&XMLCtx);
@@ -2311,6 +2323,9 @@ edg_wll_ErrorCode edg_wll_ParseQuerySequenceCodeResult(edg_wll_Context ctx, char
        edg_wll_ErrorCode errorCode;
        XML_Char *encoding = "ISO-8859-1";
 
+       if (!messageBody)
+               return edg_wll_SetError(ctx, EDG_WLL_ERROR_XML_PARSE, "Parse error: empty response");
+
        errno = 0;
        edg_wll_ResetError(ctx);
        edg_wll_initXMLCtx(&XMLCtx);
@@ -2373,6 +2388,9 @@ edg_wll_ErrorCode edg_wll_ParseStatsResult(edg_wll_Context ctx, char *messageBod
        edg_wll_ErrorCode errorCode;
        XML_Char *encoding = "ISO-8859-1";
 
+       if (!messageBody)
+               return edg_wll_SetError(ctx, EDG_WLL_ERROR_XML_PARSE, "Parse error: empty response");
+
        errno = 0;
        edg_wll_ResetError(ctx);
        edg_wll_initXMLCtx(&XMLCtx);