mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-07-26 10:28:42 +00:00
add size check to bundle content
This commit is contained in:
@@ -66,6 +66,10 @@ func BundleFromBytes(bytes []byte) (*OSCBundle, []byte, error) {
|
|||||||
|
|
||||||
remainingBytes = bytesAfterContentSize
|
remainingBytes = bytesAfterContentSize
|
||||||
|
|
||||||
|
if contentSize <= 0 {
|
||||||
|
return nil, remainingBytes, errors.New("bundle content size must be positive")
|
||||||
|
}
|
||||||
|
|
||||||
if len(remainingBytes) < int(contentSize) {
|
if len(remainingBytes) < int(contentSize) {
|
||||||
return nil, remainingBytes, errors.New("bundle doesn't have enough bytes for the content size it specifies")
|
return nil, remainingBytes, errors.New("bundle doesn't have enough bytes for the content size it specifies")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user