conn: align receive buffer to nlmsgAlign boundary#280
conn: align receive buffer to nlmsgAlign boundary#280nickgarlis merged 1 commit intomdlayher:mainfrom
Conversation
getBuffer() used MSG_PEEK|MSG_TRUNC to determine the exact byte count of the next message, then allocated a buffer of exactly that size. When the peeked length is not a multiple of 4 (the netlink alignment boundary), parseMessagesIter rounds the slice index up with nlmsgAlign, which immediately panics with "slice bounds out of range".
|
This looks good. Thanks @aojea ! Question: The main branch is now on Go 1.25. Would you prefer a patch on 1.24 or are you okay with upgrading ? |
getBuffer() used MSG_PEEK|MSG_TRUNC to determine the exact byte count of the next message, then allocated a buffer of exactly that size. When the peeked length is not a multiple of 4 (the netlink alignment boundary), parseMessagesIter rounds the slice index up with nlmsgAlign, which immediately panics with "slice bounds out of range".
getBuffer() used MSG_PEEK|MSG_TRUNC to determine the exact byte count of the next message, then allocated a buffer of exactly that size. When the peeked length is not a multiple of 4 (the netlink alignment boundary), parseMessagesIter rounds the slice index up with nlmsgAlign, which immediately panics with "slice bounds out of range".
getBuffer() used MSG_PEEK|MSG_TRUNC to determine the exact byte count of the next message, then allocated a buffer of exactly that size. When the peeked length is not a multiple of 4 (the netlink alignment boundary), parseMessagesIter rounds the slice index up with nlmsgAlign, which immediately panics with "slice bounds out of range".
I didn;t find any issue so far on my projects, so this lgtm |
|
@nickgarlis can you cut a new release? I wonder if we should use the retract directive to mark the v1.10.0 version https://go.dev/ref/mod#go-mod-file-retract |
@aojea I can do that. I was initially thinking of doing
Yes we should. Thanks for the suggestion. |
getBuffer() used MSG_PEEK|MSG_TRUNC to determine the exact byte count of the next message, then allocated a buffer of exactly that size. When the peeked length is not a multiple of 4 (the netlink alignment boundary), parseMessagesIter rounds the slice index up with nlmsgAlign, which immediately panics with "slice bounds out of range".
Fixes: #279