Date: Mon, 18 Oct 2004 15:40:47 +0000 (UTC) From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/usr.bin/xargs strnsubst.c Message-ID: <200410181540.i9IFelfE088001@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
cperciva 2004-10-18 15:40:47 UTC
FreeBSD src repository
Modified files:
usr.bin/xargs strnsubst.c
Log:
Modify behaviour of `xargs -I` in order to:
1. Conform to IEEE Std 1003.1-2004, which state that "Constructed
arguments cannot grow larger than 255 bytes", and
2. Avoid a buffer overflow.
Unfortunately the standard doesn't indicate how xargs is supposed to
handle arguments which (with the appropriate substitutions) would grow
larger than 255 bytes; this solution handles those by making as many
substitutions as possible without overflowing the buffer.
OpenBSD's xargs resolves this in a different direction, by making
all the substitutions and then silently truncating the resulting string.
Since this change may break existing scripts which rely upon the buffer
overflow (255 bytes isn't really all that long...) it will not be MFCed.
Revision Changes Path
1.7 +2 -2 src/usr.bin/xargs/strnsubst.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410181540.i9IFelfE088001>
