fixinc: avoid infinite recursion

DJ Delorie dj@redhat.com
Fri Sep 2 20:36:00 GMT 2005


We needed this on one of our internal branches, because somehow
pz_mn_name_pat got set to "" and it kept trying to peel off empty
pattern matches from the buffer.  Aside from the "that shouldn't
happen", is this a suitable bit of paranoia?

2005-09-02  DJ Delorie  <dj@redhat.com>

	* fixlib.c (mn_get_regexps): Skip both NULL strings and
	zero-length strings.

Index: fixlib.c
===================================================================
RCS file: /cvs/gcc/gcc/fixincludes/fixlib.c,v
retrieving revision 1.4
diff -p -U3 -r1.4 fixlib.c
--- fixlib.c	15 Aug 2005 00:50:43 -0000	1.4
+++ fixlib.c	2 Sep 2005 20:35:19 -0000
@@ -217,6 +217,8 @@ mn_get_regexps(regex_t** label_re, regex
 {
   if (! pz_mn_name_pat)
     return BOOL_FALSE;
+  if (! *pz_mn_name_pat)
+    return BOOL_FALSE;
 
   if (! mn_compiled)
     {



More information about the Gcc-patches mailing list