Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
ca6f6511
Commit
ca6f6511
authored
Nov 01, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid memcpy against NULL src
parent
ee844040
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
lib/nghttp2_frame.c
lib/nghttp2_frame.c
+6
-2
lib/nghttp2_helper.c
lib/nghttp2_helper.c
+4
-0
lib/nghttp2_rcbuf.c
lib/nghttp2_rcbuf.c
+2
-3
No files found.
lib/nghttp2_frame.c
View file @
ca6f6511
...
...
@@ -869,7 +869,9 @@ int nghttp2_nv_array_copy(nghttp2_nv **nva_ptr, const nghttp2_nv *nva,
p
->
name
=
nva
[
i
].
name
;
p
->
namelen
=
nva
[
i
].
namelen
;
}
else
{
memcpy
(
data
,
nva
[
i
].
name
,
nva
[
i
].
namelen
);
if
(
nva
[
i
].
namelen
)
{
memcpy
(
data
,
nva
[
i
].
name
,
nva
[
i
].
namelen
);
}
p
->
name
=
data
;
p
->
namelen
=
nva
[
i
].
namelen
;
data
[
p
->
namelen
]
=
'\0'
;
...
...
@@ -881,7 +883,9 @@ int nghttp2_nv_array_copy(nghttp2_nv **nva_ptr, const nghttp2_nv *nva,
p
->
value
=
nva
[
i
].
value
;
p
->
valuelen
=
nva
[
i
].
valuelen
;
}
else
{
memcpy
(
data
,
nva
[
i
].
value
,
nva
[
i
].
valuelen
);
if
(
nva
[
i
].
valuelen
)
{
memcpy
(
data
,
nva
[
i
].
value
,
nva
[
i
].
valuelen
);
}
p
->
value
=
data
;
p
->
valuelen
=
nva
[
i
].
valuelen
;
data
[
p
->
valuelen
]
=
'\0'
;
...
...
lib/nghttp2_helper.c
View file @
ca6f6511
...
...
@@ -503,6 +503,10 @@ int nghttp2_check_header_value(const uint8_t *value, size_t len) {
}
uint8_t
*
nghttp2_cpymem
(
uint8_t
*
dest
,
const
void
*
src
,
size_t
len
)
{
if
(
len
==
0
)
{
return
dest
;
}
memcpy
(
dest
,
src
,
len
);
return
dest
+
len
;
...
...
lib/nghttp2_rcbuf.c
View file @
ca6f6511
...
...
@@ -28,6 +28,7 @@
#include <assert.h>
#include "nghttp2_mem.h"
#include "nghttp2_helper.h"
int
nghttp2_rcbuf_new
(
nghttp2_rcbuf
**
rcbuf_ptr
,
size_t
size
,
nghttp2_mem
*
mem
)
{
...
...
@@ -58,10 +59,8 @@ int nghttp2_rcbuf_new2(nghttp2_rcbuf **rcbuf_ptr, const uint8_t *src,
return
rv
;
}
memcpy
((
*
rcbuf_ptr
)
->
base
,
src
,
srclen
);
(
*
rcbuf_ptr
)
->
len
=
srclen
;
(
*
rcbuf_ptr
)
->
base
[
srclen
]
=
'\0'
;
*
nghttp2_cpymem
((
*
rcbuf_ptr
)
->
base
,
src
,
srclen
)
=
'\0'
;
return
0
;
}
...
...
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