-
Notifications
You must be signed in to change notification settings - Fork 2k
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
driver: assure required buffer size #5239
Conversation
The cpuid buffer is also used as a temporary buffer to store the EUI-64 of the transceiver, so we need to make sure that it is always big enough. May be padded with zeroes for smaller CPUIDs.
Btw. I found this bug, when I tried to use some 802.15.4 stuff on native and copied code from the at86rf231 driver. |
|
Erm, I might have not gotten the whole patch yet (just glanced over it) but this PR seems to be more about addresses rather then about buffers. |
Just look at 6f58862 - that's the actual change. The rest is just cleanup. |
/* in case CPUID_LEN < 8, fill missing bytes with zeros */ | ||
for (int i = CPUID_LEN; i < 8; i++) { | ||
for (int i = CPUID_LEN; i < IEEE802154_LONG_ADDRESS_LEN; i++) { | ||
cpuid[i] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use memset here? (sorry, I know it's not your code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, should be fixed in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can also split up this PR in two. One with the fix and one with the cleanup, if you prefer. |
Yes, I would prefer that. |
08da266
to
6f58862
Compare
Okay, see #5242 for the cleanup. |
ACK. |
The cpuid buffer is also used as a temporary buffer to store the EUI-64 of the transceiver, so we need to make sure that it is always big enough.
May be padded with zeroes for smaller CPUIDs.