* mdocml: Fix two crashes that occur when walking very large (i.e.
@ 2011-11-13 0:53 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2011-11-13 0:53 UTC (permalink / raw)
To: source
Log Message:
-----------
Fix two crashes that occur when walking very large (i.e. real-world) trees:
1) Avoid excessive, needless recursion, lest you overflow the stack;
2) Close all dir file descriptors, lest you run out of descriptors.
ok kristaps@
Modified Files:
--------------
mdocml:
mandocdb.c
Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.6 -r1.7
--- mandocdb.c
+++ mandocdb.c
@@ -1168,10 +1168,9 @@ pman_node(MAN_ARGS)
}
}
- if (pman_node(hash, buf, dbuf, n->child))
- return(1);
- if (pman_node(hash, buf, dbuf, n->next))
- return(1);
+ for (n = n->child; n; n = n->next)
+ if (pman_node(hash, buf, dbuf, n))
+ return(1);
return(0);
}
@@ -1276,6 +1275,7 @@ ofile_dirbuild(const char *dir, int verb
}
}
+ closedir(d);
return(1);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-13 0:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-13 0:53 mdocml: Fix two crashes that occur when walking very large (i.e schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).