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
9ada072e
Unverified
Commit
9ada072e
authored
Aug 06, 2018
by
Patrick Steinhardt
Committed by
GitHub
Aug 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4758 from pks-t/pks/smart-pkt-oob-read
smart_pkt: fix potential OOB-read when processing ng packet
parents
c9ad2506
19bed3e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
src/transports/smart_pkt.c
+8
-2
No files found.
src/transports/smart_pkt.c
View file @
9ada072e
...
...
@@ -291,8 +291,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
pkt
->
ref
=
NULL
;
pkt
->
type
=
GIT_PKT_NG
;
if
(
len
<
3
)
goto
out_err
;
line
+=
3
;
/* skip "ng " */
if
(
!
(
ptr
=
strchr
(
line
,
' '
)))
len
-=
3
;
if
(
!
(
ptr
=
memchr
(
line
,
' '
,
len
)))
goto
out_err
;
len
=
ptr
-
line
;
...
...
@@ -303,8 +306,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
memcpy
(
pkt
->
ref
,
line
,
len
);
pkt
->
ref
[
len
]
=
'\0'
;
if
(
len
<
1
)
goto
out_err
;
line
=
ptr
+
1
;
if
(
!
(
ptr
=
strchr
(
line
,
'\n'
)))
len
-=
1
;
if
(
!
(
ptr
=
memchr
(
line
,
'\n'
,
len
)))
goto
out_err
;
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