1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-02 08:42:48 +00:00

Backed out rev.1.49 since it had buffer overruns and only worked

accidentally.

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
problem.
This commit is contained in:
Bruce Evans 2006-04-30 00:50:08 +00:00
parent 643df192de
commit 18d3a03e13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158152

View File

@ -397,9 +397,8 @@ showkre()
{
float f1, f2;
int psiz, inttotal;
int i, j, k, l, lc;
int i, l, lc;
static int failcnt = 0;
char intrbuffer[10];
etime = 0;
for(i = 0; i < CPUSTATES; i++) {
@ -431,15 +430,8 @@ showkre()
if (nextintsrow == LINES)
continue;
intrloc[i] = nextintsrow++;
k = 0;
for (j = 0; j < (int)sizeof(intrbuffer); j++) {
if (strncmp(&intrname[i][j], "irq", 3) == 0)
j += 3;
intrbuffer[k++] = intrname[i][j];
}
intrbuffer[k] = '\0';
mvprintw(intrloc[i], INTSCOL + 6, "%-10.10s",
intrbuffer);
intrname[i]);
}
X(intrcnt);
l = (int)((float)s.intrcnt[i]/etime + 0.5);