Skip to content
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

Ensure memcpy of mac lengths does not overflow buffers #18757

Merged
merged 4 commits into from
May 25, 2022

Conversation

andy31415
Copy link
Contributor

Problem

MAC address fetching does not provide buffer sizes and this may overflow buffers (see #16623)

Change overview

Limit size of memcpy for MAC addresses.

Fixes #16623

Testing

Compilation testing. CI will execute things on linux as well that will execute this code.

@github-actions
Copy link

github-actions bot commented May 24, 2022

PR #18757: Size comparison from 7582608 to 1d6e4fc

Increases (12 builds for linux)
platform target config section 7582608 1d6e4fc change % change
linux all-clusters-app debug (read only) 2760297 2760345 48 0.0
.text 2344258 2344306 48 0.0
bridge-app debug+rpc (read only) 2035385 2035449 64 0.0
.text 1709202 1709266 64 0.0
chip-tool debug (read only) 9490797 9490861 64 0.0
.text 7677685 7677749 64 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9234180 48 0.0
.text 7322180 7322228 48 0.0
lighting-app debug+rpc (read only) 2327737 2327785 48 0.0
.text 1973314 1973362 48 0.0
lock-app debug (read only) 2240593 2240657 64 0.0
.text 1881922 1881986 64 0.0
ota-provider-app debug (read only) 2065801 2065865 64 0.0
.text 1727362 1727426 64 0.0
ota-requestor-app debug (read only) 2094753 2094817 64 0.0
.text 1758882 1758946 64 0.0
shell debug (read only) 2576409 2576457 48 0.0
.text 2192770 2192818 48 0.0
thermostat-no-ble arm64 (read only) 2357644 2357692 48 0.0
.text 1981024 1981072 48 0.0
tv-app debug (read only) 2874185 2874249 64 0.0
.text 2470130 2470194 64 0.0
tv-casting-app debug (read only) 5451825 5451889 64 0.0
.text 4750178 4750242 64 0.0
Full report (37 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 7582608 1d6e4fc change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 669447 669447 0 0.0
(read/write) 182408 182408 0 0.0
.bss 74836 74836 0 0.0
.data 3404 3404 0 0.0
.rodata 100783 100783 0 0.0
.text 568440 568440 0 0.0
lock-ftd LP_CC2652R7 (read only) 676199 676199 0 0.0
(read/write) 166648 166648 0 0.0
.bss 72884 72884 0 0.0
.data 3236 3236 0 0.0
.rodata 94679 94679 0 0.0
.text 581036 581036 0 0.0
lock-mtd LP_CC2652R7 (read only) 625607 625607 0 0.0
(read/write) 145716 145716 0 0.0
.bss 68620 68620 0 0.0
.data 3236 3236 0 0.0
.rodata 94559 94559 0 0.0
.text 530556 530556 0 0.0
pump-app LP_CC2652R7 (read only) 676075 676075 0 0.0
(read/write) 168196 168196 0 0.0
.bss 73284 73284 0 0.0
.data 3272 3272 0 0.0
.rodata 88899 88899 0 0.0
.text 586692 586692 0 0.0
pump-controller-app LP_CC2652R7 (read only) 654035 654035 0 0.0
(read/write) 189836 189836 0 0.0
.bss 73140 73140 0 0.0
.data 3232 3232 0 0.0
.rodata 83675 83675 0 0.0
.text 569880 569880 0 0.0
shell LP_CC2652R7 (read only) 662470 662470 0 0.0
(read/write) 184944 184944 0 0.0
.bss 77196 77196 0 0.0
.data 3408 3408 0 0.0
.rodata 97750 97750 0 0.0
.text 564492 564492 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624630 624630 0 0.0
.app_xip_area 527908 527908 0 0.0
.bss 79364 79364 0 0.0
.data 708 708 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 627298 627298 0 0.0
.app_xip_area 532048 532048 0 0.0
.bss 77924 77924 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 571066 571066 0 0.0
.app_xip_area 466132 466132 0 0.0
.bss 87312 87312 0 0.0
.data 584 584 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 916036 916036 0 0.0
(read/write) 133452 133452 0 0.0
.bss 131392 131392 0 0.0
.data 2060 2060 0 0.0
.text 916028 916028 0 0.0
BRD4161A+rpc (read only) 950224 950224 0 0.0
(read/write) 150136 150136 0 0.0
.bss 147872 147872 0 0.0
.data 2264 2264 0 0.0
.text 950216 950216 0 0.0
BRD4161A+rs911x (read only) 790596 790596 0 0.0
(read/write) 129720 129720 0 0.0
.bss 127652 127652 0 0.0
.data 2068 2068 0 0.0
.text 790588 790588 0 0.0
lock-app BRD4161A+wf200 (read only) 947048 947048 0 0.0
(read/write) 124188 124188 0 0.0
.bss 122164 122164 0 0.0
.data 2024 2024 0 0.0
.text 947040 947040 0 0.0
window-app BRD4161A (read only) 897244 897244 0 0.0
(read/write) 133504 133504 0 0.0
.bss 131456 131456 0 0.0
.data 2048 2048 0 0.0
.text 897236 897236 0 0.0
esp32 all-clusters-app c3devkit (read only) 1002992 1002992 0 0.0
(read/write) 1479978 1479978 0 0.0
.dram0.bss 69392 69392 0 0.0
.dram0.data 14624 14624 0 0.0
.flash.rodata 210536 210536 0 0.0
.flash.text 1002992 1002992 0 0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1057795 1057795 0 0.0
(read/write) 481992 481992 0 0.0
.dram0.bss 74912 74912 0 0.0
.dram0.data 34200 34200 0 0.0
.flash.rodata 240884 240884 0 0.0
.flash.text 1052411 1052411 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 682968 682968 0 0.0
.bss 80432 80432 0 0.0
.data 2016 2016 0 0.0
.text 598816 598816 0 0.0
lock k32w061+release (read/write) 728996 728996 0 0.0
.bss 80856 80856 0 0.0
.data 1976 1976 0 0.0
.text 644460 644460 0 0.0
linux all-clusters-app debug (read only) 2760297 2760345 48 0.0
(read/write) 178752 178752 0 0.0
.bss 86496 86496 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 84024 84024 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1016 1016 0 0.0
.rodata 241437 241437 0 0.0
.text 2344258 2344306 48 0.0
bridge-app debug+rpc (read only) 2035385 2035449 64 0.0
(read/write) 148440 148440 0 0.0
.bss 73184 73184 0 0.0
.data 3936 3936 0 0.0
.data.rel.ro 65736 65736 0 0.0
.dynamic 592 592 0 0.0
.got 4272 4272 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 169065 169065 0 0.0
.text 1709202 1709266 64 0.0
chip-tool debug (read only) 9490797 9490861 64 0.0
(read/write) 579704 579704 0 0.0
.bss 23936 23936 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 548328 548328 0 0.0
.dynamic 624 624 0 0.0
.got 5000 5000 0 0.0
.init 27 27 0 0.0
.init_array 656 656 0 0.0
.rodata 484957 484957 0 0.0
.text 7677685 7677749 64 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9234180 48 0.0
(read/write) 645937 645937 0 0.0
.bss 42225 42225 0 0.0
.data 1192 1192 0 0.0
.data.rel.ro 583656 583656 0 0.0
.dynamic 560 560 0 0.0
.got 15016 15016 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 448564 448564 0 0.0
.text 7322180 7322228 48 0.0
lighting-app debug+rpc (read only) 2327737 2327785 48 0.0
(read/write) 154016 154016 0 0.0
.bss 74976 74976 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 71240 71240 0 0.0
.dynamic 608 608 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 188073 188073 0 0.0
.text 1973314 1973362 48 0.0
lock-app debug (read only) 2240593 2240657 64 0.0
(read/write) 148632 148632 0 0.0
.bss 73664 73664 0 0.0
.data 1568 1568 0 0.0
.data.rel.ro 67688 67688 0 0.0
.dynamic 592 592 0 0.0
.got 4336 4336 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 198713 198713 0 0.0
.text 1881922 1881986 64 0.0
ota-provider-app debug (read only) 2065801 2065865 64 0.0
(read/write) 141456 141456 0 0.0
.bss 73088 73088 0 0.0
.data 1768 1768 0 0.0
.data.rel.ro 60792 60792 0 0.0
.dynamic 608 608 0 0.0
.got 4504 4504 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 179872 179872 0 0.0
.text 1727362 1727426 64 0.0
ota-requestor-app debug (read only) 2094753 2094817 64 0.0
(read/write) 144264 144264 0 0.0
.bss 73760 73760 0 0.0
.data 1992 1992 0 0.0
.data.rel.ro 62856 62856 0 0.0
.dynamic 592 592 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 175840 175840 0 0.0
.text 1758882 1758946 64 0.0
shell debug (read only) 2576409 2576457 48 0.0
(read/write) 202776 202776 0 0.0
.bss 117416 117416 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 78224 78224 0 0.0
.dynamic 608 608 0 0.0
.got 4192 4192 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 222418 222418 0 0.0
.text 2192770 2192818 48 0.0
thermostat-no-ble arm64 (read only) 2357644 2357692 48 0.0
(read/write) 177409 177409 0 0.0
.bss 88193 88193 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 79896 79896 0 0.0
.dynamic 560 560 0 0.0
.got 4768 4768 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 147596 147596 0 0.0
.text 1981024 1981072 48 0.0
tv-app debug (read only) 2874185 2874249 64 0.0
(read/write) 280160 280160 0 0.0
.bss 191288 191288 0 0.0
.data 4672 4672 0 0.0
.data.rel.ro 77920 77920 0 0.0
.dynamic 592 592 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 221713 221713 0 0.0
.text 2470130 2470194 64 0.0
tv-casting-app debug (read only) 5451825 5451889 64 0.0
(read/write) 226880 226880 0 0.0
.bss 78936 78936 0 0.0
.data 2400 2400 0 0.0
.data.rel.ro 139336 139336 0 0.0
.dynamic 608 608 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 340929 340929 0 0.0
.text 4750178 4750242 64 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2419208 2419208 0 0.0
.bss 202860 202860 0 0.0
.data 5872 5872 0 0.0
.text 1381852 1381852 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1184523 1184523 0 0.0
bss 139560 139560 0 0.0
rodata 153684 153684 0 0.0
text 812436 812436 0 0.0
p6 all-clusters-app default (read/write) 2541288 2541288 0 0.0
.bss 137360 137360 0 0.0
.data 2808 2808 0 0.0
.text 1499552 1499552 0 0.0
light-app default (read/write) 2424616 2424616 0 0.0
.bss 129696 129696 0 0.0
.data 2608 2608 0 0.0
.text 1382880 1382880 0 0.0
lock-app default (read/write) 2435176 2435176 0 0.0
.bss 129504 129504 0 0.0
.data 2568 2568 0 0.0
.text 1393440 1393440 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 782860 782860 0 0.0
bss 70828 70828 0 0.0
noinit 40416 40416 0 0.0
text 553468 553468 0 0.0
lighting-app tlsr9518adk80d (read/write) 802884 802884 0 0.0
bss 71080 71080 0 0.0
noinit 40416 40416 0 0.0
text 570202 570202 0 0.0

src/platform/Linux/ConfigurationManagerImpl.cpp Outdated Show resolved Hide resolved
@andy31415 andy31415 merged commit 656d4c9 into project-chip:master May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buffer Overflow in DnssdServer::AdvertiseOperational
3 participants