1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-21 14:00:51 +03:00

Fixed incorrect reference to decrypted block

Fixed incorrectly copied memory from p->buf into init instead of from the decrypted buffer block. The only reason this worked was because the crypt() function decrypts the value in-place and overwrites p->buf.  I'm working on a fork that no longer does this and exposed this bug.
This commit is contained in:
Will Cosgrove
2017-12-11 11:31:57 -08:00
committed by GitHub
parent 616fd4d1b3
commit a7df51164d

View File

@@ -420,7 +420,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
} }
/* save the first 5 bytes of the decrypted package, to be /* save the first 5 bytes of the decrypted package, to be
used in the hash calculation later down. */ used in the hash calculation later down. */
memcpy(p->init, &p->buf[p->readidx], 5); memcpy(p->init, block, 5);
} else { } else {
/* the data is plain, just copy it verbatim to /* the data is plain, just copy it verbatim to
the working block buffer */ the working block buffer */