Use safe snprintf in logging, instead of sprintf. Use a small max log line length size, large sizes are an issue on the stack.