mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 19:42:45 +00:00
Throw an exception if the received app list XML was incomplete
This commit is contained in:
parent
e6527de786
commit
8fb2622b66
@ -328,6 +328,7 @@ public class NvHTTP {
|
|||||||
int eventType = xpp.getEventType();
|
int eventType = xpp.getEventType();
|
||||||
LinkedList<NvApp> appList = new LinkedList<NvApp>();
|
LinkedList<NvApp> appList = new LinkedList<NvApp>();
|
||||||
Stack<String> currentTag = new Stack<String>();
|
Stack<String> currentTag = new Stack<String>();
|
||||||
|
boolean rootTerminated = false;
|
||||||
|
|
||||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
@ -342,6 +343,9 @@ public class NvHTTP {
|
|||||||
break;
|
break;
|
||||||
case (XmlPullParser.END_TAG):
|
case (XmlPullParser.END_TAG):
|
||||||
currentTag.pop();
|
currentTag.pop();
|
||||||
|
if (xpp.getName().equals("root")) {
|
||||||
|
rootTerminated = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case (XmlPullParser.TEXT):
|
case (XmlPullParser.TEXT):
|
||||||
NvApp app = appList.getLast();
|
NvApp app = appList.getLast();
|
||||||
@ -357,6 +361,11 @@ public class NvHTTP {
|
|||||||
eventType = xpp.next();
|
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
|
// Ensure that all apps in the list are initialized
|
||||||
ListIterator<NvApp> i = appList.listIterator();
|
ListIterator<NvApp> i = appList.listIterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user