Fix for buffer overflows identified by libgmalloc