summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2006-04-30 00:50:08 +0000
committerbde <bde@FreeBSD.org>2006-04-30 00:50:08 +0000
commite2a1b6982782a35c57ff7aad9b02821ad95ef37d (patch)
tree1df011c12a7b0f2220cbeca69b076f261d90e104 /usr.bin/systat
parentabf5b08807b3f6a761ee0e34e92490f2cd8291c8 (diff)
downloadFreeBSD-src-e2a1b6982782a35c57ff7aad9b02821ad95ef37d.zip
FreeBSD-src-e2a1b6982782a35c57ff7aad9b02821ad95ef37d.tar.gz
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.
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/vmstat.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 09cbb7f..20583c9 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -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);
OpenPOWER on IntegriCloud