mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-15 11:43:40 +00:00
prevent parsing empty byte slice
This commit is contained in:
@@ -26,6 +26,10 @@ func (m *OSCMessage) ToBytes() []byte {
|
||||
}
|
||||
|
||||
func MessageFromBytes(bytes []byte) (OSCMessage, error) {
|
||||
if len(bytes) == 0 {
|
||||
return OSCMessage{}, errors.New("cannot create OSC Message from empty byte array")
|
||||
}
|
||||
|
||||
address, typeAndArgBytes := readOSCString(bytes)
|
||||
|
||||
if address[0] != 47 {
|
||||
|
||||
Reference in New Issue
Block a user