Cleanly ignore events of unknown type (fixes bug #28725).
authorZdeněk Salvet <salvet@ics.muni.cz>
Mon, 13 Aug 2007 11:22:24 +0000 (11:22 +0000)
committerZdeněk Salvet <salvet@ics.muni.cz>
Mon, 13 Aug 2007 11:22:24 +0000 (11:22 +0000)
org.glite.lb.common/src/xml_parse.c.T

index cf265ff..9c06dc0 100644 (file)
@@ -220,7 +220,7 @@ static void startQueryEvents(void *data, const char *el, const char **attr)
                                if (!attr[0] || !attr[1]) { unexpError() break;}
                                if (strcmp(attr[0],"name")) { unexpError() break;}
                                 if ( (XMLCtx->eventCode = edg_wll_StringToEvent((char *) attr[1])) 
-                                       == EDG_WLL_EVENT_UNDEF ) { unexpError() break;}
+                                       == EDG_WLL_EVENT_UNDEF ) { unexpWarning() }
                                 XMLCtx->eventsOutGlobal = realloc(XMLCtx->eventsOutGlobal,
                                                          (XMLCtx->position+1)*sizeof(*XMLCtx->eventsOutGlobal));
                                        if (!XMLCtx->eventsOutGlobal) { edg_wll_SetError(XMLCtx->ctx, ENOMEM, NULL); unexpError() return; }
@@ -852,6 +852,12 @@ static void endQueryEvents(void *data, const char *el UNUSED_VAR)
                edg_wll_freeBuf(XMLCtx);
            }
            break;
+         case 2: 
+                 /* skip events of unknown type */
+                 if (XMLCtx->eventCode == EDG_WLL_EVENT_UNDEF)
+                       edg_wll_FreeEvent(&(XMLCtx->eventsOutGlobal)[XMLCtx->position]);
+                 XMLCtx->position--;
+               /* fallthough */
          default:
            if (XMLCtx->char_buf) {
                unexpWarning()