You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently experimenting with using your library to parse syslog messages that are received via a HTTPS endpoint, i.e. the client is sending messages via a HTTP POST.
In my ServeHTTP function, I'm doing basically this:
scanner := bufio.NewScanner(req.Body)
for scanner.Scan() {
b := scanner.Bytes()
if len(b) > 0 {
var m *rfc5424.Message = &rfc5424.Message{}
if err = m.UnmarshalBinary(b); err != nil {
fmt.Printf("cannot parse msg: %v\n", err)
} else {
h.msgQueue <- *m
}
}
}
req.Body.Close()
But using this, the Message field gets screwed up if more than one syslog line is sent in the request body.
Looking at func (m *Message) UnmarshalBinary(inputBuffer []byte) I fear that the assignment
Hi @crewjam,
thanks for making that code available.
I'm currently experimenting with using your library to parse syslog messages that are received via a HTTPS endpoint, i.e. the client is sending messages via a HTTP POST.
In my
ServeHTTP
function, I'm doing basically this:But using this, the
Message
field gets screwed up if more than one syslog line is sent in the request body.Looking at
func (m *Message) UnmarshalBinary(inputBuffer []byte)
I fear that the assignmentis unsafe and should be replaced by
Best
Michael
The text was updated successfully, but these errors were encountered: