Skip to content

Commit

Permalink
in_elasticsearch: improved buffer size check
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <leonardo.alminana@chronosphere.io>
  • Loading branch information
leonardo-albertovich committed Sep 5, 2024
1 parent 2ff5372 commit bf83631
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/in_elasticsearch/in_elasticsearch_bulk_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ static int in_elasticsearch_bulk_conn_event(void *data)
}

if (NULL != request_end) {
request_len = (size_t)(request_end - conn->buf_data);
request_len = (size_t) ((uintptr_t) request_end -
(uintptr_t) conn->buf_data);

if (0 < (conn->buf_len - request_len)) {
if (request_len < conn->buf_len) {
memmove(conn->buf_data, &conn->buf_data[request_len],
conn->buf_len - request_len);

Expand Down

0 comments on commit bf83631

Please sign in to comment.