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
1 changed files with 6 additions and 1 deletions

View File

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