Other Parts Discussed in Thread: Z-STACK
Hi,
I ran 'cppcheck' on the Z-Stack 3.0.2 code and there was an interesting notification:
[Components/osal/common/OSAL_Memory.c:454]: (error) Array 'proCur[8]' accessed at index 8, which is out of bounds. [Components/osal/common/OSAL_Memory.c:455]: (error) Array 'proCur[8]' accessed at index 8, which is out of bounds. [Components/osal/common/OSAL_Memory.c:550]: (error) Array 'proCur[8]' accessed at index 8, which is out of bounds. [Components/osal/common/OSAL_Memory.c:455]: (error) Array 'proMax[8]' accessed at index 8, which is out of bounds.
That's the only valid warning, the other kind was a false positive. So that's not too bad, but it's inside a critical function.
If hdr->hdr.len always exceeds proCnt[idx], the 'idx' value reaches 'OSALMEM_PROMAX' and the array bounds are exceeded.
What is the recommended fix ?