cvs commit: src/usr.bin/systat vmstat.c

Bruce Evans bde at
Sun Apr 30 00:50:08 UTC 2006

bde         2006-04-30 00:50:08 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/systat       vmstat.c 
  Backed out rev.1.49 since it had buffer overruns and only worked
  Read buffer overruns:
  The size of the target array (TSOTTA == 10) is a wrong limit to use for
  scanning the source string.
  Write buffer overruns:
  TSOTTA is also a wrong limit to use for copying to the target buffer,
  since we want to add a NUL terminator afterwards.  TSOTTA was also 1
  too small for holding both the desired number of visible characters
  and the NUL.
  Worked accidentally:
  There is error in the algorithm that tends to result in the space saved
  by stripping "irq" not actually being used, but some cases worked
  accidentally provided "irqN" is near the end of the source string and
  "N" is only 1 digit.
  Starting with 5.mumble-CURRENT, "irqN" is at the beginning of the
  string on all (?) arches that have it and the accidents don't happen.
  E.g. on i386's, the keyboard irq is now named
  "irq1: atkbd0<bogus blank padding>" by the kernel, and this name was
  converted to "1: atkb" -- not only the device number but part of the
  device name has been lost --, while before 5.mumble the kernel name
  was "atkbd0 irq1" and systat accidentally preserved the irq number to
  give "atkbd0 1".  The ":" in the string wastes precious space, and
  stripping "irq" results in descriptions starting with numbers which
  makes them look too much like counts.  This commit just fixes the last
  Revision  Changes    Path
  1.71      +2 -10     src/usr.bin/systat/vmstat.c

More information about the cvs-src mailing list