about summary refs log tree commit diff
path: root/src/regex/glob.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-10-11 14:23:14 -0400
committerRich Felker <dalias@aerifal.cx>2018-10-11 14:23:14 -0400
commite2552581bc004f7dc5ee9ac220cad8abeae19bba (patch)
tree942f3dba632dda56ff35c63709719a95dfb50a57 /src/regex/glob.c
parent7b384c42b73ca1a1e150b3f255990ec53cedec60 (diff)
downloadmusl-e2552581bc004f7dc5ee9ac220cad8abeae19bba.tar.gz
musl-e2552581bc004f7dc5ee9ac220cad8abeae19bba.tar.xz
musl-e2552581bc004f7dc5ee9ac220cad8abeae19bba.zip
fix invalid substitute of [1] for flexible array member in glob
Diffstat (limited to 'src/regex/glob.c')
-rw-r--r--src/regex/glob.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/regex/glob.c b/src/regex/glob.c
index 746da77d..98636295 100644
--- a/src/regex/glob.c
+++ b/src/regex/glob.c
@@ -11,7 +11,7 @@
 struct match
 {
 	struct match *next;
-	char name[1];
+	char name[];
 };
 
 static int is_literal(const char *p, int useesc)
@@ -37,7 +37,7 @@ static int is_literal(const char *p, int useesc)
 
 static int append(struct match **tail, const char *name, size_t len, int mark)
 {
-	struct match *new = malloc(sizeof(struct match) + len + 1);
+	struct match *new = malloc(sizeof(struct match) + len + 2);
 	if (!new) return -1;
 	(*tail)->next = new;
 	new->next = NULL;