diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-04-29 07:25:59 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-04-29 07:25:59 +0000 |
commit | 2cb53e303f7b61abefada491815f002b591a60b8 (patch) | |
tree | a2ec1831a9979cec2a936b09e9fae16ae2e5cb39 /libc/misc/glob/glob.c | |
parent | 80e9ca2206f8b384e611ac49f111303196fe6f01 (diff) |
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->gl_offs slots of pglob->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
Diffstat (limited to 'libc/misc/glob/glob.c')
-rw-r--r-- | libc/misc/glob/glob.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index f45a2c487..8078dee38 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -260,8 +260,8 @@ globfree (pglob) { if (pglob->gl_pathv != NULL) { - register int i; - for (i = 0; i < pglob->gl_pathc; ++i) + register int i = pglob->gl_flags & GLOB_DOOFFS? pglob->gl_offs : 0; + for (; i < pglob->gl_pathc; ++i) if (pglob->gl_pathv[i] != NULL) free ((__ptr_t) pglob->gl_pathv[i]); free ((__ptr_t) pglob->gl_pathv); |