Skip to content

Commit a4507a9

Browse files
authored
Merge pull request #3 from quadrantsec/version/2.5.1
Skip traffic that doesn't start with "<"
2 parents f45533c + 0063cf3 commit a4507a9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ func (s *Server) goReadConnection(connection net.Conn) {
251251
}
252252

253253
func (s *Server) read(readCloser *ReadCloser, client string, tlsPeer string) {
254+
i := 0
254255
loop:
255256
for {
256257
select {
@@ -261,10 +262,10 @@ loop:
261262
if s.readTimeoutMilliseconds > 0 {
262263
readCloser.closer.SetReadDeadline(time.Now().Add(time.Duration(s.readTimeoutMilliseconds) * time.Millisecond))
263264
}
264-
// Read up to and including first '<'
265+
// Read up to and including '<' delimiter
265266
token, err := readCloser.ReadString('<')
266-
if token != "" {
267-
// Re-add delimiter to start; remove from end
267+
if token != "" && i > 0 { // Skip traffic that doesnt start with '<'
268+
// Re-add '<' to start; remove from end
268269
token = "<" + token[:len(token)-1]
269270
// Parse as syslog
270271
s.parser([]byte(token), client, tlsPeer)
@@ -278,6 +279,7 @@ loop:
278279
}
279280
break loop
280281
}
282+
i++
281283
}
282284
// Close connection
283285
if conn, ok := readCloser.closer.(net.Conn); ok {

0 commit comments

Comments
 (0)