diff --git a/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java b/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java index 63d99063..3b8fd8f3 100644 --- a/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java +++ b/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java @@ -328,6 +328,7 @@ public class NvHTTP { int eventType = xpp.getEventType(); LinkedList appList = new LinkedList(); Stack currentTag = new Stack(); + boolean rootTerminated = false; while (eventType != XmlPullParser.END_DOCUMENT) { switch (eventType) { @@ -342,6 +343,9 @@ public class NvHTTP { break; case (XmlPullParser.END_TAG): currentTag.pop(); + if (xpp.getName().equals("root")) { + rootTerminated = true; + } break; case (XmlPullParser.TEXT): NvApp app = appList.getLast(); @@ -357,6 +361,11 @@ public class NvHTTP { eventType = xpp.next(); } + // Throw a malformed XML exception if we've not seen the root tag ended + if (!rootTerminated) { + throw new XmlPullParserException("Malformed XML: Root tag was not terminated"); + } + // Ensure that all apps in the list are initialized ListIterator i = appList.listIterator(); while (i.hasNext()) {