cvs commit: src/usr.bin/xargs strnsubst.c

Colin Percival cperciva at FreeBSD.org
Mon Oct 18 08:40:48 PDT 2004


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


More information about the cvs-src mailing list