1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Prevent extremely long reply timeouts from being set.

Smack will throw an IllegalArguementException if extremely
long reply timeouts are tried to be set. I assumed currentTimeMilli()
to be the boundary condition as per SMACK-718
This commit is contained in:
adiaholic 2019-04-26 20:30:26 +05:30
parent 2b9cbb978e
commit af5f161fff

View file

@ -1146,8 +1146,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override @Override
public void setReplyTimeout(long timeout) { public void setReplyTimeout(long timeout) {
if (Long.MAX_VALUE - System.currentTimeMillis() < timeout) {
throw new IllegalArgumentException("Extremely long reply timeout");
}
else {
replyTimeout = timeout; replyTimeout = timeout;
} }
}
private SmackConfiguration.UnknownIqRequestReplyMode unknownIqRequestReplyMode = SmackConfiguration.getUnknownIqRequestReplyMode(); private SmackConfiguration.UnknownIqRequestReplyMode unknownIqRequestReplyMode = SmackConfiguration.getUnknownIqRequestReplyMode();