NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/39200: external program "top" overruns allocated memory for multiple cpus
>Number: 39200
>Category: bin
>Synopsis: top fails on multiple cpus
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 24 03:40:00 +0000 2008
>Originator: Geoff C. Wing
>Release: NetBSD 4.99.70
>Organization:
>Environment:
System: NetBSD g.primenet.com.au 4.99.70 NetBSD 4.99.70 (G) #0: Mon Jul 21
13:08:27 EST 2008
gcw%g.primenet.com.au@localhost:/usr/netbsd/src/sys/arch/i386/compile/G i386
Architecture: i386
Machine: i386
>Description:
top fails to reset an index on multiple cpu machines which
causes it to access memory past its allocated space.
>How-To-Repeat:
run with malloc checking
>Fix:
--- external/bsd/top/dist/display.c 2008-07-24 13:29:00.000000000 +1000
+++ external/bsd/top/dist/display.c.org 2008-07-16 10:36:15.000000000 +1000
@@ -1181,7 +1181,7 @@
int *colp;
int color = 0;
#ifdef ENABLE_COLOR
- int *cidx;
+ int *cidx = cpustate_cidx;
#endif
int c, i;
@@ -1196,9 +1196,6 @@
for (c = 0; c < (multi ? ncpu : 1); c++)
{
-#ifdef ENABLE_COLOR
- cidx = cpustate_cidx;
-#endif
/* print tag */
display_write(0, y_cpustates + c, 0, 0, cpustates_tag(c));
@@ -1247,7 +1244,7 @@
int *colp;
int color = 0;
#ifdef ENABLE_COLOR
- int *cidx;
+ int *cidx = cpustate_cidx;
#endif
int c, i;
@@ -1264,9 +1261,6 @@
for (c = 0; c < (multi ? ncpu : 1); c++)
{
-#ifdef ENABLE_COLOR
- cidx = cpustate_cidx;
-#endif
colp = cpustate_columns;
/* we could be much more optimal about this */
for (names = cpustate_names; (thisname = *names++) != NULL;)
Home |
Main Index |
Thread Index |
Old Index