Skip to content

Commit 848b335

Browse files
committed
handle buffer overflow and prevent java.nio.BufferOverflowException when message is too big
1 parent faa8e07 commit 848b335

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/fluentd/logger/sender/RawSocketSender.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ private synchronized boolean send(byte[] bytes) {
165165
LOG.error("Cannot send logs to " + server.toString());
166166
return false;
167167
}
168-
if (bytes.length > pendings.capacity()) {
169-
LOG.error("Log data larger {} than buffer size {}", bytes.length, pendings.capacity());
168+
if (bytes.length > pendings.remaining()) {
169+
LOG.error("Log data {} larger than remaining buffer size {}", bytes.length, pendings.remaining());
170170
return false;
171171
}
172172
}

0 commit comments

Comments
 (0)