Re: ps -f bug

Gevan Dutton (shanos@es.co.nz)
Wed, 20 Nov 1996 19:15:14 +1300 (NZDT)


On Tue, 19 Nov 1996, Mike wrote:

> Hello.. A few days ago in my mad ravings I mentioned that ps was seg faulting
> on me. It was brought to my attention that ps used to seg fault when the
> -f flag was used, and when there were > 64 processes. I have found this
> to still be true. I used "ps -fxaOp" and saw it segfault. I then used
> "ps -xaOp" and it did not segfault. I then immediatly ran ps again with
> it's first arguments, and it seg faulted.

I seem to remember being told there was another similar problem somewhere
else, but here's the one I found -

--- ps.c~ Wed Sep 25 08:22:44 1996
+++ ps.c Wed Sep 25 08:20:01 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);