Add a bunch of overflow checks near malloc()s