mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-08-18 21:43:23 +02:00
wc_CryptoCb_CryptInitRenesasCmn() derived the slot index from a free-running device id counter and wrote gCbCtx[] without checking the index against MAX_FSPSM_CBINDEX. Since the function is called once per WOLFSSL session, the sixth registration in the lifetime of a process wrote a pointer past the end of the array. Look for a free slot inside the hardware lock instead and derive the device id from that slot, so a full table is rejected with INVALID_DEVID. wc_CryptoCb_CleanupRenesasCmn() now clears the slot, which makes it available to a later registration and drops the stale pointer to a context the application may free. Also correct the upper bound checks in Renesas_cmn_GetCbCtxBydevId() and wc_CryptoCb_CleanupRenesasCmn(), which both accepted an index one past the last element. Fixes F-7438.