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
cfed1be8
Commit
cfed1be8
authored
May 24, 2018
by
Carlos Martín Nieto
Committed by
Patrick Steinhardt
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
submodule: plug leaks from the escape detection
parent
f650153a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
src/submodule.c
+10
-3
tests/submodule/escape.c
+2
-0
No files found.
src/submodule.c
View file @
cfed1be8
...
...
@@ -186,10 +186,13 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
fdot
=
strchr
(
entry
->
name
,
'.'
);
ldot
=
strrchr
(
entry
->
name
,
'.'
);
git_buf_clear
(
&
buf
);
git_buf_put
(
&
buf
,
fdot
+
1
,
ldot
-
fdot
-
1
);
isvalid
=
git_submodule_name_is_valid
(
repo
,
buf
.
ptr
,
0
);
if
(
isvalid
<
0
)
return
isvalid
;
if
(
isvalid
<
0
)
{
error
=
isvalid
;
goto
out
;
}
if
(
!
isvalid
)
continue
;
...
...
@@ -199,9 +202,13 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
return
-
1
;
}
}
if
(
error
==
GIT_ITEROVER
)
error
=
0
;
out:
git_buf_free
(
&
buf
);
git_config_iterator_free
(
iter
);
return
0
;
return
error
;
}
int
git_submodule_lookup
(
...
...
tests/submodule/escape.c
View file @
cfed1be8
...
...
@@ -43,6 +43,7 @@ void test_submodule_escape__from_gitdir(void)
"[submodule
\"
"
EVIL_SM_NAME
"
\"
]
\n
"
" path = testrepo
\n
"
" url = ../testrepo.git
\n
"
);
git_buf_free
(
&
buf
);
/* Find it all the different ways we know about it */
foundit
=
0
;
...
...
@@ -76,6 +77,7 @@ void test_submodule_escape__from_gitdir_windows(void)
"[submodule
\"
"
EVIL_SM_NAME_WINDOWS
"
\"
]
\n
"
" path = testrepo
\n
"
" url = ../testrepo.git
\n
"
);
git_buf_free
(
&
buf
);
/* Find it all the different ways we know about it */
foundit
=
0
;
...
...
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