From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pAD0rDVH019324 for ; Sat, 12 Nov 2011 19:53:13 -0500 (EST) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id pAD0rDVv001612; Sat, 12 Nov 2011 19:53:13 -0500 (EST) Date: Sat, 12 Nov 2011 19:53:13 -0500 (EST) Message-Id: <201111130053.pAD0rDVv001612@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Fix two crashes that occur when walking very large (i.e. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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