Skip to content

Commit

Permalink
Fix stack overflow in SSHCredentials constructor (JuliaLang#21779)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored May 11, 2017
1 parent df443c1 commit 1129de3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/libgit2/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ mutable struct SSHCredentials <: AbstractCredentials
finalizer(c, securezero!)
return c
end
SSHCredentials(u::AbstractString,p::AbstractString,prompt_if_incorrect::Bool=false) = SSHCredentials(u,p,prompt_if_incorrect)
SSHCredentials(u::AbstractString,p::AbstractString,prompt_if_incorrect::Bool=false) = SSHCredentials(u,p,"","",prompt_if_incorrect)
SSHCredentials(prompt_if_incorrect::Bool=false) = SSHCredentials("","","","",prompt_if_incorrect)
end

Expand Down
5 changes: 5 additions & 0 deletions test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,11 @@ mktempdir() do dir
@test LibGit2.checkused!(creds)
@test creds.user == creds_user
@test creds.pass == creds_pass
sshcreds = LibGit2.SSHCredentials(creds_user, creds_pass)
@test sshcreds.user == creds_user
@test sshcreds.pass == creds_pass
@test isempty(sshcreds.prvkey)
@test isempty(sshcreds.pubkey)
end

# The following tests require that we can fake a TTY so that we can provide passwords
Expand Down

0 comments on commit 1129de3

Please sign in to comment.