Skip to content

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

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 
}
 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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