<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"> ------------------------------------------------------------------------
r6825 | andersen | 2003-04-29 02:25:59 -0500 (Tue, 29 Apr 2003) | 10 lines
Changed paths:
   M /trunk/uClibc/libc/misc/glob/glob.c

uClibc 0.9.19 has a bug in globfree(). If the previous call to
glob(...,pglob) used the GLOB_DOOFFS flag to reserve the first
pglob-&gt;gl_offs slots of pglob-&gt;gl_pathv, globfree(pglob) would attempt
to free the objects pointed to by those slots. If those objects were not
on the heap, the system would crash.

The attached patch fixes this.

Norm

 ------------------------------------------------------------------------
Index: libc/misc/glob/glob.c
===================================================================
--- libc/misc/glob/glob.c	(revision 6824)
+++ libc/misc/glob/glob.c	(revision 6825)
@@ -260,8 +260,8 @@
 {
   if (pglob-&gt;gl_pathv != NULL)
     {
-      register int i;
-      for (i = 0; i &lt; pglob-&gt;gl_pathc; ++i)
+      register int i = pglob-&gt;gl_flags &amp; GLOB_DOOFFS? pglob-&gt;gl_offs : 0;
+      for (; i &lt; pglob-&gt;gl_pathc; ++i)
 	if (pglob-&gt;gl_pathv[i] != NULL)
 	  free ((__ptr_t) pglob-&gt;gl_pathv[i]);
       free ((__ptr_t) pglob-&gt;gl_pathv);
</pre></body></html>