lkml.org 
[lkml]   [1996]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: ps segfault
Date

Pete Harlan writes:
> > > we just noticed this "ps axf" causes a segmentation fault on 2.0.23 using
> > > the procps-1.01 ...
> >
> > Doesn't do that here. Same versions used.
Depends on, where it comes from... ;^)

> It segfaults when the number of processes is greater than 64. (63?)
> It's a bug in ps.
Correct, it's an 'of-by-one' error -- try this one:
== snip ==
diff -ur procps-1.01/ps.c procps-1.01-ray/ps.c
--- procps-1.01/ps.c Wed Jun 12 14:39:36 1996
+++ procps-1.01-ray/ps.c Tue Oct 1 18:58:31 1996
@@ -515,7 +515,7 @@
node = (struct tree_node *)
malloc(sizeof(struct tree_node) * maxnodes);
}
- if (nodes > maxnodes) {
+ if (nodes >= maxnodes) {
maxnodes *= 2;
node = (struct tree_node *)
realloc(node, sizeof(struct tree_node) * maxnodes);
== snip ==
Regards,
--
Raymund Will ray@lst.de

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.072 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site