aboutsummaryrefslogtreecommitdiff
path: root/src/libcrypto.c
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2014-09-26 21:13:01 -0700
committerAndreas Schneider <asn@cryptomilk.org>2014-10-02 08:25:53 +0200
commitaf25c5e668fa817521496ac2278127b516f219d3 (patch)
tree8d2e9299e4ab014c714cd06fa3a3af0c627c4031 /src/libcrypto.c
parent092fe0b727399cd971709c16c030bc093ca54d87 (diff)
downloadlibssh-af25c5e668fa817521496ac2278127b516f219d3.tar.gz
libssh-af25c5e668fa817521496ac2278127b516f219d3.tar.xz
libssh-af25c5e668fa817521496ac2278127b516f219d3.zip
crypto: check malloc return in ssh_mac_ctx_init
Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/libcrypto.c')
-rw-r--r--src/libcrypto.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcrypto.c b/src/libcrypto.c
index 84afbb09..479c8c18 100644
--- a/src/libcrypto.c
+++ b/src/libcrypto.c
@@ -250,7 +250,11 @@ void md5_final(unsigned char *md, MD5CTX c) {
}
ssh_mac_ctx ssh_mac_ctx_init(enum ssh_mac_e type){
- ssh_mac_ctx ctx=malloc(sizeof(struct ssh_mac_ctx_struct));
+ ssh_mac_ctx ctx = malloc(sizeof(struct ssh_mac_ctx_struct));
+ if (ctx == NULL) {
+ return NULL;
+ }
+
ctx->mac_type=type;
switch(type){
case SSH_MAC_SHA1: