-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
It's kind of a miracle this worked at all:
rinasense/components/Enrollment/SerdesMsg.c
Line 320 in 0c53686
| uint8_t *pucBuffer[1500]; |
This allocates a large buffer on the stack, which is alright on its own, but then the address of this buffer is returned to the caller:
This is a big NO, and Valgrind is freaking out, justifiably so:
==86136== Thread 1:
==86136== Invalid read of size 8
==86136== at 0x484A345: memmove (vg_replace_strmem.c:1382)
==86136== by 0x486E367: prvRibdEncodeCDAP (Ribd.c:524)
==86136== by 0x486FDB9: xRibdSendRequest (Ribd.c:1154)
==86136== by 0x486953A: vFlowAllocatorFlowRequest (FlowAllocator.c:290)
==86136== by 0x48707E1: prvConnect (RINA_API.c:316)
==86136== by 0x48708AF: RINA_flow_alloc (RINA_API.c:352)
==86136== by 0x10A4A4: main (test_linux.c:35)
==86136== Address 0x1ffeffc870 is on thread 1's stack
==86136== 12328 bytes below stack pointer
==86136==
==86136== Invalid read of size 8
==86136== at 0x484A35F: memmove (vg_replace_strmem.c:1382)
==86136== by 0x486E367: prvRibdEncodeCDAP (Ribd.c:524)
==86136== by 0x486FDB9: xRibdSendRequest (Ribd.c:1154)
...
The stack buffer is also too big to deal with for Arduino so I need to change this code.
Metadata
Metadata
Assignees
Labels
No labels