about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
Diffstat (limited to 'posix')
-rw-r--r--posix/glob.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/posix/glob.c b/posix/glob.c
index 38a6d75ab2..1354150653 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -635,7 +635,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
       nfound = 1;
       names = (struct globlink *) __alloca (sizeof (struct globlink));
       names->next = NULL;
-      names->name = (char *) malloc (len + 1);
+      names->name = (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1);
       if (names->name == NULL)
 	goto memory_error;
       memcpy (names->name, pattern, len);