Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
eb1eb584
Commit
eb1eb584
authored
Apr 10, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3038 from pks-t/fix-regcomp-retval-check
Fix checking of return value for regcomp.
parents
a01d3a0b
129022ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
6 deletions
+18
-6
src/config.c
+3
-3
src/config_file.c
+2
-2
src/diff_driver.c
+1
-1
tests/config/read.c
+12
-0
No files found.
src/config.c
View file @
eb1eb584
...
...
@@ -478,7 +478,7 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
iter
=
git__calloc
(
1
,
sizeof
(
all_iter
));
GITERR_CHECK_ALLOC
(
iter
);
if
((
result
=
regcomp
(
&
iter
->
regex
,
regexp
,
REG_EXTENDED
))
<
0
)
{
if
((
result
=
regcomp
(
&
iter
->
regex
,
regexp
,
REG_EXTENDED
))
!=
0
)
{
giterr_set_regex
(
&
iter
->
regex
,
result
);
regfree
(
&
iter
->
regex
);
git__free
(
iter
);
...
...
@@ -513,7 +513,7 @@ int git_config_backend_foreach_match(
int
error
=
0
;
if
(
regexp
!=
NULL
)
{
if
((
error
=
regcomp
(
&
regex
,
regexp
,
REG_EXTENDED
))
<
0
)
{
if
((
error
=
regcomp
(
&
regex
,
regexp
,
REG_EXTENDED
))
!=
0
)
{
giterr_set_regex
(
&
regex
,
error
);
regfree
(
&
regex
);
return
-
1
;
...
...
@@ -1004,7 +1004,7 @@ int git_config_multivar_iterator_new(git_config_iterator **out, const git_config
if
(
regexp
!=
NULL
)
{
error
=
regcomp
(
&
iter
->
regex
,
regexp
,
REG_EXTENDED
);
if
(
error
<
0
)
{
if
(
error
!=
0
)
{
giterr_set_regex
(
&
iter
->
regex
,
error
);
error
=
-
1
;
regfree
(
&
iter
->
regex
);
...
...
src/config_file.c
View file @
eb1eb584
...
...
@@ -576,7 +576,7 @@ static int config_set_multivar(
}
result
=
regcomp
(
&
preg
,
regexp
,
REG_EXTENDED
);
if
(
result
<
0
)
{
if
(
result
!=
0
)
{
giterr_set_regex
(
&
preg
,
result
);
result
=
-
1
;
goto
out
;
...
...
@@ -662,7 +662,7 @@ static int config_delete_multivar(git_config_backend *cfg, const char *name, con
refcounted_strmap_free
(
map
);
result
=
regcomp
(
&
preg
,
regexp
,
REG_EXTENDED
);
if
(
result
<
0
)
{
if
(
result
!=
0
)
{
giterr_set_regex
(
&
preg
,
result
);
result
=
-
1
;
goto
out
;
...
...
src/diff_driver.c
View file @
eb1eb584
...
...
@@ -116,7 +116,7 @@ static int diff_driver_add_patterns(
if
(
error
<
0
)
break
;
if
((
error
=
regcomp
(
&
pat
->
re
,
buf
.
ptr
,
regex_flags
))
<
0
)
{
if
((
error
=
regcomp
(
&
pat
->
re
,
buf
.
ptr
,
regex_flags
))
!=
0
)
{
/* if regex fails to compile, warn? fail? */
error
=
giterr_set_regex
(
&
pat
->
re
,
error
);
regfree
(
&
pat
->
re
);
...
...
tests/config/read.c
View file @
eb1eb584
...
...
@@ -350,6 +350,18 @@ static void check_glob_iter(git_config *cfg, const char *regexp, int expected)
git_config_iterator_free
(
iter
);
}
void
test_config_read__iterator_invalid_glob
(
void
)
{
git_config
*
cfg
;
git_config_iterator
*
iter
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config9"
)));
cl_git_fail
(
git_config_iterator_glob_new
(
&
iter
,
cfg
,
"*"
));
git_config_free
(
cfg
);
}
void
test_config_read__iterator_glob
(
void
)
{
git_config
*
cfg
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment