Date: Mon, 15 Jul 2002 09:04:20 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: keramida@FreeBSD.ORG Cc: bde@zeta.org.au, des@ofug.org, freebsd-audit@FreeBSD.ORG Subject: Re: bin/ln & WARNS=5 Message-ID: <20020715.090420.83279095.imp@bsdimp.com> In-Reply-To: <20020715111436.GD50130@hades.hell.gr> References: <xzpele59w21.fsf@flood.ping.uio.no> <20020715202126.S40071-100000@gamplex.bde.org> <20020715111436.GD50130@hades.hell.gr>
index | next in thread | previous in thread | raw e-mail
In message: <20020715111436.GD50130@hades.hell.gr>
Giorgos Keramidas <keramida@FreeBSD.ORG> writes:
: + if ((pathlen = snprintf(path, sizeof(path), "%s/%s",
: + source, p)) == -1 || pathlen >= (int)sizeof(path)) {
That's down right stupid.
snprintf never returns a negative number. It always returns the
number of characters that it would have used to make the string.
The code was right before. However, maybe the following is better and
clearer:
if (strlen(source) + strlen(p) + 1 >= PATH_MAX) {
... ETOOLONG stuff
}
snprintf(...);
Warner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020715.090420.83279095.imp>
