Commit f1ac46b4 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Added validation of show values in Presence packets. JM-452

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3031 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4ab38011
...@@ -203,6 +203,7 @@ public abstract class SocketReader implements Runnable { ...@@ -203,6 +203,7 @@ public abstract class SocketReader implements Runnable {
session.process(reply); session.process(reply);
continue; continue;
} }
// Check that the presence type is valid. If not then assume available type
try { try {
packet.getType(); packet.getType();
} }
...@@ -212,6 +213,16 @@ public abstract class SocketReader implements Runnable { ...@@ -212,6 +213,16 @@ public abstract class SocketReader implements Runnable {
// an available presence type // an available presence type
packet.setType(null); packet.setType(null);
} }
// Check that the presence show is valid. If not then assume available show value
try {
packet.getShow();
}
catch (IllegalArgumentException e) {
Log.warn("Invalid presence show", e);
// The presence packet contains an invalid presence show so replace it with
// an available presence show
packet.setShow(null);
}
processPresence(packet); processPresence(packet);
} }
else if ("iq".equals(tag)) { else if ("iq".equals(tag)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment