diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-01 21:30:53 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-01 21:30:53 +0000 |
commit | 10397d44db3c7ed17b194cdeaf3ba04e9602957c (patch) | |
tree | 4a76d3a08da74a78b2187eea5826732f904977f3 /libssh | |
parent | fc73b0b33fbd787f10c370e8bc12946104ef376a (diff) | |
download | libssh-10397d44db3c7ed17b194cdeaf3ba04e9602957c.tar.gz libssh-10397d44db3c7ed17b194cdeaf3ba04e9602957c.tar.xz libssh-10397d44db3c7ed17b194cdeaf3ba04e9602957c.zip |
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
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/crypt.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libssh/crypt.c b/libssh/crypt.c index 9d8fa0f..9148e84 100644 --- a/libssh/crypt.c +++ b/libssh/crypt.c @@ -88,10 +88,14 @@ unsigned char * packet_encrypt(SSH_SESSION *session,void *data,u32 len){ #elif defined HAVE_LIBCRYPTO crypto->set_encrypt_key(crypto,session->current_crypto->encryptkey); #endif - out=malloc(len); + out = malloc(len); + if (out == NULL) { + return NULL; + } if(session->version==2){ ctx = hmac_init(session->current_crypto->encryptMAC,20,HMAC_SHA1); if (ctx == NULL) { + SAFE_FREE(out); return NULL; } hmac_update(ctx,(unsigned char *)&seq,sizeof(u32)); |