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
8ced4627
Commit
8ced4627
authored
Aug 11, 2018
by
Christian Schlack
Committed by
Patrick Steinhardt
Oct 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'invalid packet line' for ng packets containing errors
(cherry picked from commit
50dd7fea
)
parent
ffc20564
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
src/transports/smart_pkt.c
+9
-7
No files found.
src/transports/smart_pkt.c
View file @
8ced4627
...
@@ -290,7 +290,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
...
@@ -290,7 +290,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
static
int
ng_pkt
(
git_pkt
**
out
,
const
char
*
line
,
size_t
len
)
static
int
ng_pkt
(
git_pkt
**
out
,
const
char
*
line
,
size_t
len
)
{
{
git_pkt_ng
*
pkt
;
git_pkt_ng
*
pkt
;
const
char
*
ptr
;
const
char
*
ptr
,
*
eol
;
size_t
alloclen
;
size_t
alloclen
;
pkt
=
git__malloc
(
sizeof
(
*
pkt
));
pkt
=
git__malloc
(
sizeof
(
*
pkt
));
...
@@ -299,11 +299,13 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
...
@@ -299,11 +299,13 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
pkt
->
ref
=
NULL
;
pkt
->
ref
=
NULL
;
pkt
->
type
=
GIT_PKT_NG
;
pkt
->
type
=
GIT_PKT_NG
;
eol
=
line
+
len
;
if
(
len
<
3
)
if
(
len
<
3
)
goto
out_err
;
goto
out_err
;
line
+=
3
;
/* skip "ng " */
line
+=
3
;
/* skip "ng " */
len
-=
3
;
if
(
!
(
ptr
=
memchr
(
line
,
' '
,
len
)))
if
(
!
(
ptr
=
memchr
(
line
,
' '
,
eol
-
line
)))
goto
out_err
;
goto
out_err
;
len
=
ptr
-
line
;
len
=
ptr
-
line
;
...
@@ -314,11 +316,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
...
@@ -314,11 +316,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
memcpy
(
pkt
->
ref
,
line
,
len
);
memcpy
(
pkt
->
ref
,
line
,
len
);
pkt
->
ref
[
len
]
=
'\0'
;
pkt
->
ref
[
len
]
=
'\0'
;
if
(
len
<
1
)
goto
out_err
;
line
=
ptr
+
1
;
line
=
ptr
+
1
;
len
-=
1
;
if
(
line
>=
eol
)
if
(
!
(
ptr
=
memchr
(
line
,
'\n'
,
len
)))
goto
out_err
;
if
(
!
(
ptr
=
memchr
(
line
,
'\n'
,
eol
-
line
)))
goto
out_err
;
goto
out_err
;
len
=
ptr
-
line
;
len
=
ptr
-
line
;
...
...
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