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
b643501d
Commit
b643501d
authored
9 years ago
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3614 from pks-t/pks/coverity-fixes
Coverity fixes
parents
c1b75f05
8a62bf11
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
3 deletions
+30
-3
script/user_nodefs.h
+19
-0
src/netops.c
+4
-0
src/signature.c
+2
-3
src/transports/smart_pkt.c
+3
-0
src/transports/smart_protocol.c
+2
-0
No files found.
script/user_nodefs.h
View file @
b643501d
...
...
@@ -6,3 +6,22 @@
*/
#nodef GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); }
#nodef GITERR_CHECK_ALLOC_ADD(out, one, two) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { __coverity_panic__(); }
#nodef GITERR_CHECK_ALLOC_ADD3(out, one, two, three) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { __coverity_panic__(); }
#nodef GITERR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { __coverity_panic__(); }
#nodef GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { __coverity_panic__(); }
#nodef GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) { __coverity_panic__(); }
#nodef LOOKS_LIKE_DRIVE_PREFIX(S) (strlen(S) >= 2 && git__isalpha((S)[0]) && (S)[1] == ':')
This diff is collapsed.
Click to expand it.
src/netops.c
View file @
b643501d
...
...
@@ -261,6 +261,10 @@ int gitno_extract_url_parts(
*
path
=
git__substrdup
(
_path
,
u
.
field_data
[
UF_PATH
].
len
);
GITERR_CHECK_ALLOC
(
*
path
);
}
else
{
git__free
(
*
port
);
*
port
=
NULL
;
git__free
(
*
host
);
*
host
=
NULL
;
giterr_set
(
GITERR_NET
,
"invalid url, missing path"
);
return
GIT_EINVALIDSPEC
;
}
...
...
This diff is collapsed.
Click to expand it.
src/signature.c
View file @
b643501d
...
...
@@ -79,10 +79,9 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
GITERR_CHECK_ALLOC
(
p
);
p
->
name
=
extract_trimmed
(
name
,
strlen
(
name
));
GITERR_CHECK_ALLOC
(
p
->
name
);
p
->
email
=
extract_trimmed
(
email
,
strlen
(
email
));
if
(
p
->
name
==
NULL
||
p
->
email
==
NULL
)
return
-
1
;
/* oom */
GITERR_CHECK_ALLOC
(
p
->
email
);
if
(
p
->
name
[
0
]
==
'\0'
||
p
->
email
[
0
]
==
'\0'
)
{
git_signature_free
(
p
);
...
...
This diff is collapsed.
Click to expand it.
src/transports/smart_pkt.c
View file @
b643501d
...
...
@@ -271,6 +271,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
line
+=
3
;
/* skip "ok " */
if
(
!
(
ptr
=
strchr
(
line
,
'\n'
)))
{
giterr_set
(
GITERR_NET
,
"Invalid packet line"
);
git__free
(
pkt
);
return
-
1
;
}
len
=
ptr
-
line
;
...
...
@@ -314,6 +315,8 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
line
=
ptr
+
1
;
if
(
!
(
ptr
=
strchr
(
line
,
'\n'
)))
{
giterr_set
(
GITERR_NET
,
"Invalid packet line"
);
git__free
(
pkt
->
ref
);
git__free
(
pkt
);
return
-
1
;
}
len
=
ptr
-
line
;
...
...
This diff is collapsed.
Click to expand it.
src/transports/smart_protocol.c
View file @
b643501d
...
...
@@ -108,6 +108,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
if
(
giterr_last
()
->
klass
!=
GITERR_NOMEMORY
)
goto
on_invalid
;
git__free
(
mapping
);
return
error
;
}
...
...
@@ -120,6 +121,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
on_invalid:
giterr_set
(
GITERR_NET
,
"remote sent invalid symref"
);
git_refspec__free
(
mapping
);
git__free
(
mapping
);
return
-
1
;
}
...
...
This diff is collapsed.
Click to expand it.
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