-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
netlink: potential to optimize AttributeEncoder's buffer length calculation #191
Comments
It seems you're correct! A length check should be added to each of Bytes, Do, and String. Want to send a PR? |
Sure thing, mate. I'll send the PR tomorrow after work. I'm also seeing a small performance optimization that we can integrate without affecting code readability. This will effectively make this for-loop redundant, because we've already computed the length. Thus, marshalling a slice of attributes via the encoder is now an Note that this will require refactoring the What do you think? |
Internal improvements are always welcome, as long as they don't dramatically impact the readability of the code! I'd be happy to take a look at what you have in mind. |
Updates #191 Signed-off-by: Matt Layher <mdlayher@gmail.com>
I've committed a fix for the length overflow issue, but will retitle this for the performance improvement issue. |
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?
The text was updated successfully, but these errors were encountered: