8000 Fix CertificateSsh constructor · libgit2/libgit2sharp@1171cfb · GitHub
[go: up one dir, main page]

Skip to content

Commit 1171cfb

Browse files
committed
Fix CertificateSsh constructor
Should fix #1383.
1 parent 52e689c commit 1171cfb

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

LibGit2Sharp/CertificateSsh.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,22 @@ protected CertificateSsh()
3535
/// </summary>
3636
public readonly bool HasSHA1;
3737

38-
/// <summary>
39-
/// True if we have the SHA1 hostkey hash from the server
40-
/// </summary>public readonly bool HasSHA1;
41-
4238
internal unsafe CertificateSsh(git_certificate_ssh* cert)
4339
{
4440

4541
HasMD5 = cert->type.HasFlag(GitCertificateSshType.MD5);
4642
HasSHA1 = cert->type.HasFlag(GitCertificateSshType.SHA1);
4743

4844
HashMD5 = new byte[16];
49-
fixed (byte* p = &HashMD5[0])
45+
for (var i = 0; i < HashMD5.Length; i++)
5046
{
51-
for (var i = 0; i < HashMD5.Length; i++)
52-
{
53-
HashMD5[i] = p[i];
54-
}
47+
HashMD5[i] = cert->HashMD5[i];
5548
}
5649

5750
HashSHA1 = new byte[20];
58-
fixed (byte* p = &HashSHA1[0])
51+
for (var i = 0; i < HashSHA1.Length; i++)
5952
{
60-
for (var i = 0; i < HashSHA1.Length; i++)
61-
{
62-
HashSHA1[i] = p[i];
63-
}
53+
HashSHA1[i] = cert->HashSHA1[i];
6454
}
6555
}
6656

LibGit2Sharp/Core/GitCertificateSsh.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal unsafe struct git_certificate_ssh
1414
public unsafe fixed byte HashMD5[16];
1515

1616
/// <summary>
17-
/// The MD5 hash (if appropriate)
17+
/// The SHA1 hash (if appropriate)
1818
/// </summary>
1919
public unsafe fixed byte HashSHA1[20];
2020
}

0 commit comments

Comments
 (0)
0