Ticket 63: Android CallbackServer crashes on external attacks.

This commit is contained in:
Bryce Curtis 2011-01-13 14:45:15 -06:00
parent f16d9b01b7
commit 9051b157f8

View File

@ -188,11 +188,14 @@ public class CallbackServer implements Runnable {
request = xhrReader.readLine();
String response = "";
//System.out.println("CallbackServerRequest="+request);
if (request != null) {
if (this.active && (request != null)) {
if (request.contains("GET")) {
// Get requested file
String[] requestParts = request.split(" ");
// Must have security token
if (request.substring(5,41).equals(this.token)) {
if ((requestParts.length == 3) && (requestParts[1].equals(this.token))) {
//System.out.println("CallbackServer -- Processing GET request");
// Wait until there is some data to send, or send empty data every 10 sec
@ -236,7 +239,7 @@ public class CallbackServer implements Runnable {
//System.out.println("CallbackServer: closing output");
output.writeBytes(response);
output.flush();
}
}
output.close();
xhrReader.close();
}