Address of local variable buffer is assigned to a non-local variable
Open
- Dominant language
- C
- Stars
- 2.8k
- Forks
- 1.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 1
Description
https://github.com/ARMmbed/DAPLink/blob/06fa0a9ca76a0f4b2732b030ebbcba9e6e20a708/source/board/microbitv2/nrf52820/pwr_mon_adc.c#L76
A stack address is assigned to a non-local variable. Storing the address of a local variable in non-local memory can cause a dangling pointer bug if the address is used after the function returns.
Contributor guide
Research direction
Start at source/board/microbitv2/nrf52820/pwr_mon_adc.c:76 and inspect the local buffer, the non-local variable receiving its address, and callers that use it. Determine how to prevent the address from outliving the local variable, then verify the affected power-monitoring behavior on the relevant firmware target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100