This fixes all warnings on my system.
I am not sure about the last commit. The warnings caught potential snprintf truncations, but to trigger those warnings means we need to use hard coded values. An alternative is to turn all those into runtime errors
ret = snprintf(...); assert(ret >= 0 && ret < buf_size);
by adding a wrapper to snprintf. Thoughts?