Closed
Description
While reading through the LibGit2Sharp code, I noticed something that looks wrong to me. Here's the code as it is currently (lines 48-55 of CertificateSsh.cs
):
HashMD5 = new byte[16];
fixed (byte* p = &HashMD5[0])
{
for (var i = 0; i < HashMD5.Length; i++)
{
HashMD5[i] = p[i];
}
}
That looks like it's intended to copy the MD5 hash from the git_certificate_ssh
struct passed in as the cert
parameter. But what it's actually doing is to allocate a new 16-byte array, and copy it onto itself, basically performing a no-op.
I think that fixed (byte* p = &HashMD5[0])
should be changed to fixed (byte* p = &cert->HashMD5[0])
. And likewise with the next fixed
block: fixed (byte* p = &HashSHA1[0])
should be changed to fixed (byte* p = &cert->HashSHA1[0])
.
Metadata
Metadata
Assignees
Labels
No labels