Skip to content

netlink: potential to optimize AttributeEncoder's buffer length calculation #191

@ubiquitousbyte

Description

@ubiquitousbyte

This may seem rather overanalyzed, but I was reading through the code and found a potential pitfall in the String function of the AttributeEncoder type.
Isn't the following check necessary to prevent the length field of the attribute being appended from overflowing?

if len(s) > math.MaxUint16-nlaHeaderLen {
   ae.err = errors.New("Attribute length overflow")
   return 
}
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions