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
a622ff17
Commit
a622ff17
authored
Apr 18, 2014
by
Jacques Germishuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only zero sensitive information on destruction (and memory actually allocated by us)
parent
043112dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
src/transports/cred.c
+21
-7
No files found.
src/transports/cred.c
View file @
a622ff17
...
...
@@ -30,7 +30,6 @@ static void plaintext_free(struct git_cred *cred)
git__free
(
c
->
password
);
}
git__memzero
(
c
,
sizeof
(
*
c
));
git__free
(
c
);
}
...
...
@@ -73,8 +72,13 @@ static void ssh_key_free(struct git_cred *cred)
(
git_cred_ssh_key
*
)
cred
;
git__free
(
c
->
username
);
git__free
(
c
->
publickey
);
git__free
(
c
->
privatekey
);
if
(
c
->
privatekey
)
{
/* Zero the memory which previously held the private key */
size_t
key_len
=
strlen
(
c
->
privatekey
);
git__memzero
(
c
->
privatekey
,
key_len
);
git__free
(
c
->
privatekey
);
}
if
(
c
->
passphrase
)
{
/* Zero the memory which previously held the passphrase */
...
...
@@ -83,7 +87,13 @@ static void ssh_key_free(struct git_cred *cred)
git__free
(
c
->
passphrase
);
}
git__memzero
(
c
,
sizeof
(
*
c
));
if
(
c
->
publickey
)
{
/* Zero the memory which previously held the public key */
size_t
key_len
=
strlen
(
c
->
publickey
);
git__memzero
(
c
->
publickey
,
key_len
);
git__free
(
c
->
publickey
);
}
git__free
(
c
);
}
...
...
@@ -93,7 +103,6 @@ static void ssh_interactive_free(struct git_cred *cred)
git__free
(
c
->
username
);
git__memzero
(
c
,
sizeof
(
*
c
));
git__free
(
c
);
}
...
...
@@ -102,9 +111,14 @@ static void ssh_custom_free(struct git_cred *cred)
git_cred_ssh_custom
*
c
=
(
git_cred_ssh_custom
*
)
cred
;
git__free
(
c
->
username
);
git__free
(
c
->
publickey
);
git__memzero
(
c
,
sizeof
(
*
c
));
if
(
c
->
publickey
)
{
/* Zero the memory which previously held the publickey */
size_t
key_len
=
strlen
(
c
->
publickey
);
git__memzero
(
c
->
publickey
,
key_len
);
git__free
(
c
->
publickey
);
}
git__free
(
c
);
}
...
...
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