Skip to content

Commit

Permalink
The default value of doxm.sct set by iotivity-lite can be larger than…
Browse files Browse the repository at this point in the history
… 255 (#499)

* The default value of doxm.sct set by iotivity-lite can be larger than uint8 which leads to a failed decoding of Doxm resource.
  • Loading branch information
lubo-svk authored Sep 27, 2024
1 parent cc07b73 commit 4187ed3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/codec/ocf/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (VNDOCFCBORCodec) Decode(m *pool.Message, v interface{}) error {
}
if err := cbor.ReadFrom(m.Body(), v); err != nil {
p, _ := m.Options().Path()
return fmt.Errorf("decoding failed for the message %v on %v", m.Token(), p)
return fmt.Errorf("decoding failed for the message %v on %v with error: %w", m.Token(), p, err)
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions schema/credential/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Credential struct {
Tag string `json:"tag,omitempty" yaml:"tag,omitempty"`
}

type CredentialType uint8
type CredentialType uint16

const (
CredentialType_EMPTY CredentialType = 0
Expand Down Expand Up @@ -86,7 +86,7 @@ func (c CredentialType) String() string {
c &^= CredentialType_ASYMMETRIC_ENCRYPTION_KEY
}
if c != 0 {
res = append(res, fmt.Sprintf("unknown(%v)", uint8(c)))
res = append(res, fmt.Sprintf("unknown(%v)", uint16(c)))
}
return strings.Join(res, "|")
}
Expand Down

0 comments on commit 4187ed3

Please sign in to comment.