-
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
Use CopyString() Instead of strncpy() #22708
Use CopyString() Instead of strncpy() #22708
Conversation
PR #22708: Size comparison from 989ad8e to cb86607 Increases (14 builds for bl702, cc13x2_26x2, esp32, k32w, nrfconnect)
Decreases (26 builds for bl702, cc13x2_26x2, esp32, linux, nrfconnect, qpg, telink)
Full report (30 builds for bl702, cc13x2_26x2, esp32, k32w, linux, nrfconnect, qpg, telink)
|
cb86607
to
696276e
Compare
PR #22708: Size comparison from 989ad8e to 696276e Increases (20 builds for bl702, cc13x2_26x2, esp32, k32w, mbed, nrfconnect, psoc6)
Decreases (39 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, linux, nrfconnect, psoc6, qpg, telink)
Full report (49 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
696276e
to
b997c23
Compare
PR #22708: Size comparison from 0cf7694 to b997c23 Increases (20 builds for bl702, cc13x2_26x2, esp32, k32w, mbed, nrfconnect, psoc6)
Decreases (40 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, linux, nrfconnect, psoc6, qpg, telink)
Full report (49 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
PR #22708: Size comparison from 847f450 to 1dca688 Increases (16 builds for bl702, cc13x2_26x2, k32w, nrfconnect, psoc6)
Decreases (32 builds for bl602, bl702, cc13x2_26x2, cyw30739, nrfconnect, psoc6, qpg, telink)
Full report (35 builds for bl602, bl702, cc13x2_26x2, cyw30739, k32w, nrfconnect, psoc6, qpg, telink)
|
1dca688
to
31b4541
Compare
PR #22708: Size comparison from 3aa138f to 31b4541 Increases (20 builds for bl702, cc13x2_26x2, esp32, k32w, linux, mbed, nrfconnect, psoc6)
Decreases (40 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, linux, nrfconnect, psoc6, qpg, telink)
Full report (49 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
@@ -195,7 +196,7 @@ class ComplexArgumentParser | |||
|
|||
size_t size = strlen(value.asCString()); | |||
auto buffer = static_cast<char *>(chip::Platform::MemoryCalloc(size, sizeof(char))); | |||
strncpy(buffer, value.asCString(), size); | |||
chip::Platform::CopyString(buffer, size, value.asCString()); |
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.
This is causing a problem since strncpy does not null terminate while CopyString does
…::CopyString to memcpy (it previously uses to be strncpy which was confusing)
… to memcpy (it previously uses to be strncpy which was confusing) (#23231)
…::CopyString to memcpy (it previously uses to be strncpy which was confusing) (project-chip#23231)
…::CopyString to memcpy (it previously uses to be strncpy which was confusing) (project-chip#23231)
Issue Being Resolved
strncpy
Max Copy Length Does Not Always Copy Null Terminator #19339Change overview
Replaced strncpy() with CopyString()