From: Junio C Hamano Date: Tue, 18 Apr 2006 19:32:12 GMT Subject: Re: [PATCH 1/7] cleanups: Fix resource leak and buffer overrun in daemon.c Message-ID: <7vzmiiel37.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20060418131106.GD7562@sergelap.austin.ibm.com> "Serge E. Hallyn" writes: > Argh, I had to pull out a sheet of paper, but you are right. I > misread, and the warning must be about the case where the > snprint "[%ld] " prints out 1023 characters. If snprintf(buf, sizeof(buf), "[%ld] ", (long) getpid()) is judged to possibly overrun the buffer by your static analysis tool, I think the tool is broken. It at least should know how big a printed long can be. It would earn bonus points if it can warn me when sizeof(buf) is sufficiently small, say 40 bytes, with a message like "on future architectures with 128-bit long this code might break" ;-).