cast sprintf to size_t. -1 will be very large, so it still looks like
bufferoverrun and action (exit) is taken accordingly.