diff options
author | Szabolcs Nagy <nsz@port70.net> | 2016-05-21 15:21:38 +0200 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-05-22 17:52:19 -0400 |
commit | 51eeb6ebc94d965768143c45e9f39b0a7998bdbd (patch) | |
tree | 43b335225c8a7ad9ff9aebcab51b3face81e3782 /src/regex | |
parent | 63e3a1661f1fa5552e2023683617ce09fac3248b (diff) | |
download | musl-51eeb6ebc94d965768143c45e9f39b0a7998bdbd.tar.gz musl-51eeb6ebc94d965768143c45e9f39b0a7998bdbd.tar.bz2 musl-51eeb6ebc94d965768143c45e9f39b0a7998bdbd.tar.xz musl-51eeb6ebc94d965768143c45e9f39b0a7998bdbd.zip |
fix the use of uninitialized value in regcomp
the num_submatches field of some ast nodes was not initialized in
tre_add_tag_{left,right}, but was accessed later.
this was a benign bug since the uninitialized values were never used
(these values are created during tre_add_tags and copied around during
tre_expand_ast where they are also used in computations, but nothing
in the final tnfa depends on them).
Diffstat (limited to 'src/regex')
-rw-r--r-- | src/regex/regcomp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index 5fad98b3..65f2fd0b 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -1106,6 +1106,7 @@ tre_add_tag_left(tre_mem_t mem, tre_ast_node_t *node, int tag_id) c->right->firstpos = NULL; c->right->lastpos = NULL; c->right->num_tags = 0; + c->right->num_submatches = 0; node->obj = c; node->type = CATENATION; return REG_OK; @@ -1136,6 +1137,7 @@ tre_add_tag_right(tre_mem_t mem, tre_ast_node_t *node, int tag_id) c->left->firstpos = NULL; c->left->lastpos = NULL; c->left->num_tags = 0; + c->left->num_submatches = 0; node->obj = c; node->type = CATENATION; return REG_OK; |