diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2013-12-09 22:03:34 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2014-12-10 18:35:18 +0100 |
commit | 5b17b79a895bb9eace11d4596acadaa2ed69cf2d (patch) | |
tree | b72dc1b0a2cdc9e0b1ce4f05fb39dba0fd5c4603 /engines/e_capi.c | |
parent | 3a7581bf5ae3579e506b18f4b36c266c84890450 (diff) | |
download | openssl-5b17b79a895bb9eace11d4596acadaa2ed69cf2d.tar.gz |
capi_ctrl, capi_vtrace: check for NULL after allocating and free it
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'engines/e_capi.c')
-rw-r--r-- | engines/e_capi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/engines/e_capi.c b/engines/e_capi.c index 87a10dd4fc..8a19ed05c7 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -340,6 +340,11 @@ static int capi_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) } ctx = ENGINE_get_ex_data(e, capi_idx); out = BIO_new_fp(stdout, BIO_NOCLOSE); + if (out == NULL) + { + CAPIerr(CAPI_F_CAPI_CTRL, CAPI_R_FILE_OPEN_ERROR); + return 0; + } switch (cmd) { case CAPI_CMD_LIST_CSPS: @@ -406,6 +411,7 @@ static int capi_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) if (i < 1 || i > 3) { CAPIerr(CAPI_F_CAPI_CTRL, CAPI_R_INVALID_LOOKUP_METHOD); + BIO_free(out); return 0; } ctx->lookup_method = i; @@ -1081,6 +1087,11 @@ static void capi_vtrace(CAPI_CTX *ctx, int level, char *format, va_list argptr) if (!ctx || (ctx->debug_level < level) || (!ctx->debug_file)) return; out = BIO_new_file(ctx->debug_file, "a+"); + if (out == NULL) + { + CAPIerr(CAPI_F_CAPI_VTRACE, CAPI_R_FILE_OPEN_ERROR); + return; + } BIO_vprintf(out, format, argptr); BIO_free(out); } |