From 3732b43333754108039c96e7f535d2983945fe5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Mon, 28 Jun 2010 18:54:19 +0000 Subject: [PATCH] Check for NULL before parsing purge request (needed for expat < 2.0). Fixes crash in purge utility on strange jobid list. --- org.glite.lb.common/src/xml_parse.c.T | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/org.glite.lb.common/src/xml_parse.c.T b/org.glite.lb.common/src/xml_parse.c.T index 797c9e6..c17d35e 100644 --- a/org.glite.lb.common/src/xml_parse.c.T +++ b/org.glite.lb.common/src/xml_parse.c.T @@ -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); -- 1.8.2.3