From af5f161fff5b30bc3f87e6a713786226d9ef664b Mon Sep 17 00:00:00 2001 From: adiaholic Date: Fri, 26 Apr 2019 20:30:26 +0530 Subject: [PATCH] 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 --- .../org/jivesoftware/smack/AbstractXMPPConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index dfe4d5662..dbbf0e7d5 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -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();