The SIP parser does not fail on partial SIP messages
- Dominant language
- Go
- Stars
- 6.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
If you attempt to parse a truncated or partial SIP message, the parser does not throw any type of error when used as:
```
parser := gopacket.NewDecodingLayerParser( layers.LayerTypeSIP, sip, )
```
I believe there should a call to SetTruncated() in the SIP parser where:
```
// Read next line
line, err = buffer.ReadBytes(byte('\n'))
if err != nil {
if err == io.EOF {
break
} else {
return err
}
}
```
should actually be:
```
// Read next line
line, err = buffer.ReadBytes(byte('\n'))
if err != nil {
if err == io.EOF {
if len(bytes.Trim(line, "\r\n")) > 0 {
df.SetTruncated()
}
break
} else {
return err
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.