about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-07 17:43:38 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-07 17:43:38 -0400
commita5a47783359dff3e583693bcddc1c5e3311d96ac (patch)
treebd97502b2fb12bc0ae6f2d603a3f6217a816d76c
parentd7a90b35b9b5336a3e730e09d56f1c53f4e946ee (diff)
downloadmusl-a5a47783359dff3e583693bcddc1c5e3311d96ac.tar.gz
musl-a5a47783359dff3e583693bcddc1c5e3311d96ac.tar.xz
musl-a5a47783359dff3e583693bcddc1c5e3311d96ac.zip
fix regex breakage in last commit (failure to handle empty regex, etc.)
-rw-r--r--src/regex/regcomp.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index fa79e2e5..5f119d17 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -1149,10 +1149,6 @@ tre_parse(tre_parse_ctx_t *ctx)
 	     an empty set of `()', a bracket expression, `.', `^', `$',
 	     a `\' followed by a character, or a single character. */
 
-	  /* End of regexp? (empty string). */
-	  if (!*ctx->re)
-	    goto parse_literal;
-
 	  switch (*ctx->re)
 	    {
 	    case CHAR_LPAREN:  /* parenthesized subexpression */
@@ -1394,6 +1390,7 @@ tre_parse(tre_parse_ctx_t *ctx)
 	      if (!(ctx->cflags & REG_EXTENDED))
 	        goto parse_literal;
 
+	    case 0:
 	    empty_atom:
 	      result = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
 	      if (!result)