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
048f837b
Commit
048f837b
authored
Oct 31, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent another segfault from bad URL
parent
887df99f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/netops.c
+1
-1
src/transports/ssh.c
+6
-5
No files found.
src/netops.c
View file @
048f837b
...
@@ -680,7 +680,7 @@ int gitno_extract_url_parts(
...
@@ -680,7 +680,7 @@ int gitno_extract_url_parts(
at
=
strchr
(
url
,
'@'
);
at
=
strchr
(
url
,
'@'
);
if
(
!
slash
||
if
(
!
slash
||
(
colon
&&
slash
<
colon
))
{
(
colon
&&
(
slash
<
colon
)
))
{
giterr_set
(
GITERR_NET
,
"Malformed URL"
);
giterr_set
(
GITERR_NET
,
"Malformed URL"
);
return
GIT_EINVALIDSPEC
;
return
GIT_EINVALIDSPEC
;
}
}
...
...
src/transports/ssh.c
View file @
048f837b
...
@@ -213,10 +213,6 @@ static int git_ssh_extract_url_parts(
...
@@ -213,10 +213,6 @@ static int git_ssh_extract_url_parts(
colon
=
strchr
(
url
,
':'
);
colon
=
strchr
(
url
,
':'
);
if
(
colon
==
NULL
)
{
giterr_set
(
GITERR_NET
,
"Malformed URL: missing :"
);
return
-
1
;
}
at
=
strchr
(
url
,
'@'
);
at
=
strchr
(
url
,
'@'
);
if
(
at
)
{
if
(
at
)
{
...
@@ -228,6 +224,11 @@ static int git_ssh_extract_url_parts(
...
@@ -228,6 +224,11 @@ static int git_ssh_extract_url_parts(
*
username
=
NULL
;
*
username
=
NULL
;
}
}
if
(
colon
==
NULL
||
(
colon
<
start
))
{
giterr_set
(
GITERR_NET
,
"Malformed URL"
);
return
-
1
;
}
*
host
=
git__substrdup
(
start
,
colon
-
start
);
*
host
=
git__substrdup
(
start
,
colon
-
start
);
GITERR_CHECK_ALLOC
(
*
host
);
GITERR_CHECK_ALLOC
(
*
host
);
...
@@ -316,7 +317,7 @@ static int _git_ssh_setup_conn(
...
@@ -316,7 +317,7 @@ static int _git_ssh_setup_conn(
const
char
*
cmd
,
const
char
*
cmd
,
git_smart_subtransport_stream
**
stream
)
git_smart_subtransport_stream
**
stream
)
{
{
char
*
host
,
*
port
=
NULL
,
*
user
=
NULL
,
*
pass
=
NULL
;
char
*
host
=
NULL
,
*
port
=
NULL
,
*
user
=
NULL
,
*
pass
=
NULL
;
const
char
*
default_port
=
"22"
;
const
char
*
default_port
=
"22"
;
ssh_stream
*
s
;
ssh_stream
*
s
;
LIBSSH2_SESSION
*
session
=
NULL
;
LIBSSH2_SESSION
*
session
=
NULL
;
...
...
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