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
65e96579
Commit
65e96579
authored
Dec 07, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shrpx: Replace strncpy + putting null with memcpy in ssl_pem_passwd_cb
parent
06220f7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+5
-6
No files found.
src/shrpx_ssl.cc
View file @
65e96579
...
@@ -91,8 +91,8 @@ void set_npn_prefs(unsigned char *out, const char **protos, size_t len)
...
@@ -91,8 +91,8 @@ void set_npn_prefs(unsigned char *out, const char **protos, size_t len)
}
}
}
// namespace
}
// namespace
namespace
{
static
int
ssl_pem_passwd_cb
(
char
*
buf
,
int
size
,
int
rwflag
,
void
*
user_data
)
int
ssl_pem_passwd_cb
(
char
*
buf
,
int
size
,
int
rwflag
,
void
*
user_data
)
{
{
Config
*
config
=
(
Config
*
)
user_data
;
Config
*
config
=
(
Config
*
)
user_data
;
int
len
=
(
int
)
strlen
(
config
->
private_key_passwd
);
int
len
=
(
int
)
strlen
(
config
->
private_key_passwd
);
...
@@ -100,12 +100,11 @@ static int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *user_data)
...
@@ -100,12 +100,11 @@ static int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *user_data)
LOG
(
ERROR
)
<<
"ssl_pem_passwd_cb: buf is too small "
<<
size
;
LOG
(
ERROR
)
<<
"ssl_pem_passwd_cb: buf is too small "
<<
size
;
return
0
;
return
0
;
}
}
// Copy string including last '\0'.
strncpy
(
buf
,
config
->
private_key_passwd
,
len
);
memcpy
(
buf
,
config
->
private_key_passwd
,
len
+
1
);
buf
[
len
]
=
'\0'
;
return
len
;
return
len
;
}
}
}
// namespace
SSL_CTX
*
create_ssl_context
()
SSL_CTX
*
create_ssl_context
()
{
{
...
...
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