Skip to content

Commit

Permalink
pos needs to be added delimiter_size
Browse files Browse the repository at this point in the history
in test, here is MSG-LEN. +1 is unnecessary

https://tools.ietf.org/html/rfc6587#section-3.4.1

Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
  • Loading branch information
ganmacs committed Apr 9, 2020
1 parent 2d50f34 commit affd42b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def start_tcp_server(tls: false)
if octet_count_frame
while idx = buffer.index(delimiter, pos)
num = Integer(buffer[pos..idx])
pos = idx + num
pos = idx + num + 1
msg = buffer[idx + 1...pos]
if msg.size < num - 1
pos = pos - num - num.to_s.size
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_in_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def create_test_case(large_message: false)
]
msgs.each { |msg|
m = msg['msg']
msg['msg'] = "#{m.size + 1} #{m}"
msg['msg'] = "#{m.size} #{m}"
}
msgs
end
Expand Down

0 comments on commit affd42b

Please sign in to comment.