-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix unsafe use of strncpy in OpenThread dns-sd code. #13392
Merged
bzbarsky-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:fix-unsafe-strncpy-openthread
Jan 11, 2022
Merged
Fix unsafe use of strncpy in OpenThread dns-sd code. #13392
bzbarsky-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:fix-unsafe-strncpy-openthread
Jan 11, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
andy31415,
anush-apple,
balducci-apple,
Byungjoo-Lee,
carol-apple,
cecille,
chrisdecenzo,
chshu,
chulspro,
Damian-Nordic,
dhrishi,
electrocucaracha,
emargolis,
erjiaqing,
franck-apple,
gjc13,
harimau-qirex,
hawk248,
holbrookt,
jelderton,
jepenven-silabs,
jmartinez-silabs,
kghost,
LuDuda,
lzgrablic02,
msandstedt and
pan-apple
January 8, 2022 06:19
pullapprove
bot
requested review from
robszewczyk,
sagar-apple,
saurabhst,
selissia,
tcarmelveilleux,
tecimovic,
vijs,
vivien-apple,
wbschiller,
woody-apple and
xylophone21
January 8, 2022 06:19
PR #13392: Size comparison from 5d0c314 to 8f3bfa2 Increases (14 builds for efr32, k32w, nrfconnect)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
msandstedt
reviewed
Jan 8, 2022
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp
Outdated
Show resolved
Hide resolved
andy31415
approved these changes
Jan 10, 2022
Damian-Nordic
approved these changes
Jan 10, 2022
bzbarsky-apple
force-pushed
the
fix-unsafe-strncpy-openthread
branch
2 times, most recently
from
January 10, 2022 16:33
7853ccf
to
4bad9d5
Compare
PR #13392: Size comparison from 08753ba to 4bad9d5 Increases (14 builds for efr32, k32w, nrfconnect)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
bzbarsky-apple
force-pushed
the
fix-unsafe-strncpy-openthread
branch
from
January 10, 2022 18:28
4bad9d5
to
26b2267
Compare
PR #13392: Size comparison from 5053f20 to 26b2267 Increases (14 builds for efr32, k32w, nrfconnect)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
For the three uses where we are copying data of some computed size into a buffer, add checks that the size is not too big for the buffer (and in particular that we will be able to null-terminate after copying). For the one use where we are copying the entire buffer between two identical-sized buffers: 1) Assert that the target buffer us not smaller than the source buffer. 2) Use CopyString to ensure null-termination even if the source is not null-terminated.
bzbarsky-apple
force-pushed
the
fix-unsafe-strncpy-openthread
branch
from
January 11, 2022 16:58
26b2267
to
0d8fbd7
Compare
PR #13392: Size comparison from 1cbec52 to 0d8fbd7 Increases (15 builds for efr32, k32w, nrfconnect)
Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
selissia
pushed a commit
to selissia/connectedhomeip
that referenced
this pull request
Jan 28, 2022
) For the three uses where we are copying data of some computed size into a buffer, add checks that the size is not too big for the buffer (and in particular that we will be able to null-terminate after copying). For the one use where we are copying the entire buffer between two identical-sized buffers: 1) Assert that the target buffer us not smaller than the source buffer. 2) Use CopyString to ensure null-termination even if the source is not null-terminated.
step0035
pushed a commit
to hank820/connectedhomeip
that referenced
this pull request
Feb 8, 2022
) For the three uses where we are copying data of some computed size into a buffer, add checks that the size is not too big for the buffer (and in particular that we will be able to null-terminate after copying). For the one use where we are copying the entire buffer between two identical-sized buffers: 1) Assert that the target buffer us not smaller than the source buffer. 2) Use CopyString to ensure null-termination even if the source is not null-terminated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For the three uses where we are copying data of some computed size
into a buffer, add checks that the size is not too big for the buffer
(and in particular that we will be able to null-terminate after
copying).
For the one use where we are copying the entire buffer between two
identical-sized buffers:
Assert that the target buffer us not smaller than the source buffer.
Use CopyString to ensure null-termination even if the source is not
null-terminated.
Problem
Looks to me like this code can end up with buffer overruns.
Change overview
Avoid those buffer overruns.
Testing
I have no idea how to test this code with data that would in fact trigger the buffer overruns without this PR, but it would be a really good idea to do that... Ideas on how to do it are very welcome.