zephyr/lib/cmsis_rtos_v2
Andy Ross 0d4954fafc lib/cmsis_rtos_v2: Fix overflow in osKernelGetInfo()
If any of the Zephyr version numbers went beyond 99, the "%2d" printf
specifiers would expand to fit and the string would run over the
memory on the stack used for os_str[].

Recent GCC versions (remember native_posix and x86_64 use the host
compiler) were actually detecting this and correctly issuing a warning
(but only if the 3-digit char value would overflow the actual array
size!), which was breaking sanitycheck for me on Fedora 28 and Ubuntu
18.04 build hosts.  Pretty impresive warning.

As it happens this was wasteful anyway; we were spending bytes on the
stack (and in rodata to store the constant which, and the cycles
needed to copy it into place on the stack where it would be
overwritten immediately) when we could just snprintf() directly into
the buffer the user gave us.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-12-26 09:41:41 -05:00
..
CMakeLists.txt lib/cmsis_rtos_v2: Implement support for Thread Flags APIs 2018-12-20 12:23:22 +01:00
Kconfig lib/cmsis_rtos_v2: Implement support for Event Flag APIs 2018-12-20 12:23:22 +01:00
event_flags.c lib/cmsis_rtos_v2: Implement support for Event Flag APIs 2018-12-20 12:23:22 +01:00
kernel.c lib/cmsis_rtos_v2: Fix overflow in osKernelGetInfo() 2018-12-26 09:41:41 -05:00
mempool.c lib/cmsis_rtos_v2: Implement support for mempool APIs 2018-12-20 12:23:22 +01:00
msgq.c lib/cmsis_rtos_v2: Implement support for Message Queue APIs 2018-12-20 12:23:22 +01:00
mutex.c lib/cmsis_rtos_v2: Implement support for mutex APIs 2018-12-20 12:23:22 +01:00
semaphore.c lib/cmsis_rtos_v2: Implement support for semaphore APIs 2018-12-20 12:23:22 +01:00
thread.c
thread_flags.c lib/cmsis_rtos_v2: Implement support for Thread Flags APIs 2018-12-20 12:23:22 +01:00
timer.c lib/cmsis_rtos_v2: Implement support for timer APIs 2018-12-20 12:23:22 +01:00
wrapper.h lib/cmsis_rtos_v2: Implement support for Event Flag APIs 2018-12-20 12:23:22 +01:00