Re: [PATCH 1/7] cleanups: Fix resource leak and buffer overrun in daemon.c

From: Junio C Hamano <junkio@cox.net>
Date: 2006-04-19 05:32:12
"Serge E. Hallyn" <serue@us.ibm.com> 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" ;-).

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Apr 19 05:34:25 2006

This archive was generated by hypermail 2.1.8 : 2006-04-19 05:34:45 EST