Skip to content

Commit 4187ed3

Browse files
authored
The default value of doxm.sct set by iotivity-lite can be larger than 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.
1 parent cc07b73 commit 4187ed3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/codec/ocf/codec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (VNDOCFCBORCodec) Decode(m *pool.Message, v interface{}) error {
6464
}
6565
if err := cbor.ReadFrom(m.Body(), v); err != nil {
6666
p, _ := m.Options().Path()
67-
return fmt.Errorf("decoding failed for the message %v on %v", m.Token(), p)
67+
return fmt.Errorf("decoding failed for the message %v on %v with error: %w", m.Token(), p, err)
6868
}
6969
return nil
7070
}

schema/credential/credential.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type Credential struct {
4444
Tag string `json:"tag,omitempty" yaml:"tag,omitempty"`
4545
}
4646

47-
type CredentialType uint8
47+
type CredentialType uint16
4848

4949
const (
5050
CredentialType_EMPTY CredentialType = 0
@@ -86,7 +86,7 @@ func (c CredentialType) String() string {
8686
c &^= CredentialType_ASYMMETRIC_ENCRYPTION_KEY
8787
}
8888
if c != 0 {
89-
res = append(res, fmt.Sprintf("unknown(%v)", uint8(c)))
89+
res = append(res, fmt.Sprintf("unknown(%v)", uint16(c)))
9090
}
9191
return strings.Join(res, "|")
9292
}

0 commit comments

Comments
 (0)