diff --git a/protocol.go b/protocol.go index 1febf8b71..0c59ef56e 100644 --- a/protocol.go +++ b/protocol.go @@ -295,6 +295,11 @@ func (c *rawConnection) readerLoop() (err error) { switch msg := msg.(type) { case IndexMessage: + if msg.Flags != 0 { + // We don't currently support or expect any flags. + return fmt.Errorf("protocol error: unknown flags 0x%x in Index(Update) message", msg.Flags) + } + switch hdr.msgType { case messageTypeIndex: if c.state < stateCCRcvd { @@ -311,6 +316,10 @@ func (c *rawConnection) readerLoop() (err error) { } case RequestMessage: + if msg.Flags != 0 { + // We don't currently support or expect any flags. + return fmt.Errorf("protocol error: unknown flags 0x%x in Request message", msg.Flags) + } if c.state < stateIdxRcvd { return fmt.Errorf("protocol error: request message in state %d", c.state) }