Fix memory corruption caused by rolling unsigned ints in snprintf calls