[PATCH] fix off-by-one in dump_childnos()
Tommi Rantala <[email protected]> Sun, 16 Apr 2017 21:29:14 +0300
| Newsgroups | org.kernel.vger.trinity |
|---|---|
| Message-ID | <[email protected]> |
Fixes a segfault:
## pids: (60 active)
0-7: 0 0 0 0 0 0 0 0
8-15: 0 0 0 0 0 0 0 0
16-23: 0 0 0 0 0 0 0 0
24-31: 0 0 0 0 0 0 0 0
32-39: 0 11081 11082 11083 11084 11085 11086 11087
40-47: 11088 11089 11090 11091 11093 11094 11095 11096
48-55: 11097 11098 11099 11100 11101 11102 0 0
Segmentation fault
---
pids.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pids.c b/pids.c
index 8b77e2f..1a23284 100644
--- a/pids.c
+++ b/pids.c
@@ -82,7 +82,7 @@ void dump_childnos(void)
for (j = 0; j < 8; j++) {
struct childdata *child;
- if (i + j > max_children)
+ if (i + j >= max_children)
break;
child = shm->children[i + j];
--
2.9.3