Skip to content

Commit

Permalink
Check object path
Browse files Browse the repository at this point in the history
  • Loading branch information
black-desk authored and jsouthworth committed Sep 2, 2021
1 parent cc14158 commit cd3ee85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ func (enc *encoder) encode(v reflect.Value, depth int) {
if strings.IndexByte(str, byte(0)) != -1 {
panic(FormatError("input has a null char('\\000') in string"))
}
if v.Type() == objectPathType {
if !ObjectPath(str).IsValid() {
panic(FormatError("invalid object path"))
}
}
enc.encode(reflect.ValueOf(uint32(len(str))), depth)
b := make([]byte, v.Len()+1)
copy(b, str)
Expand Down

0 comments on commit cd3ee85

Please sign in to comment.