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
50dd7fea
Commit
50dd7fea
authored
Aug 11, 2018
by
Christian Schlack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'invalid packet line' for ng packets containing errors
parent
9913e2df
Hide 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 @
50dd7fea
...
@@ -282,7 +282,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
...
@@ -282,7 +282,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
));
...
@@ -291,11 +291,13 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
...
@@ -291,11 +291,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
;
...
@@ -306,11 +308,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
...
@@ -306,11 +308,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