fix ratelimit memory corruption

(cherry picked from commit 19cd04ab12fe37a4fd5685e7eabde1d435f8c8b4)