Permalink
Browse files

Fixed timeout int wraparound bug

If int is multiplied by 1000 and this value is greater than int.MAX_VALUE, a wraparound will occur resulting in a large negative number.  This will effectively make the timeout end immediately instead of lasting indefinitely.
  • Loading branch information...
1 parent 5176831 commit 8ee840c7364372781c66c593d42394440a21f059 @fragnemesis committed Mar 22, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 Expect.java
View
@@ -258,7 +258,7 @@ public int expect(int timeout, List<Pattern> list) {
log.debug("Expecting " + list);
clearGlobalVariables();
- long endTime = System.currentTimeMillis() + timeout * 1000;
+ long endTime = System.currentTimeMillis() + (long)timeout * 1000;
try {
ByteBuffer bytes = ByteBuffer.allocate(1024);

0 comments on commit 8ee840c

Please sign in to comment.