mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
Add one missing memory error check in crypt.c.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@333 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -89,9 +89,13 @@ unsigned char * packet_encrypt(SSH_SESSION *session,void *data,u32 len){
|
|||||||
crypto->set_encrypt_key(crypto,session->current_crypto->encryptkey);
|
crypto->set_encrypt_key(crypto,session->current_crypto->encryptkey);
|
||||||
#endif
|
#endif
|
||||||
out = malloc(len);
|
out = malloc(len);
|
||||||
|
if (out == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if(session->version==2){
|
if(session->version==2){
|
||||||
ctx = hmac_init(session->current_crypto->encryptMAC,20,HMAC_SHA1);
|
ctx = hmac_init(session->current_crypto->encryptMAC,20,HMAC_SHA1);
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
|
SAFE_FREE(out);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
hmac_update(ctx,(unsigned char *)&seq,sizeof(u32));
|
hmac_update(ctx,(unsigned char *)&seq,sizeof(u32));
|
||||||
|
|||||||
Reference in New Issue
Block a user