Hardened malloc
What is it?
An excerpt on github [1]:
This is a security-focused general purpose memory allocator providing the malloc API along with various extensions. It provides substantial hardening against heap corruption vulnerabilities.
How to use
Note: Need Alpine Linux Edge with testing repo in /etc/apk/repositories
$ doas apk add hardened-malloc
Then you can set LD_PRELOAD="/usr/lib/libhardened_malloc.so"
while launching individual applications or before your window manager starts if you prefer. For a more global setting placing the LD_PRELOAD reference into /etc/profile or /etc/profile.d/ might help, as well as /etc/environment for PAM-based systems.
External sources
Hardened malloc github