From 88eecd145c903035d467afe311d5b54016dc5280 Mon Sep 17 00:00:00 2001 From: miod <> Date: Sat, 14 Feb 2015 15:13:24 +0000 Subject: Potential NULL dereference in the error path; Coverity CID 21720 ok doug@ jsing@ --- src/lib/libcrypto/bn/bn_exp.c | 4 ++-- src/lib/libssl/src/crypto/bn/bn_exp.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index eecab5163b..12de0c5a12 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_exp.c,v 1.20 2015/02/09 15:49:22 jsing Exp $ */ +/* $OpenBSD: bn_exp.c,v 1.21 2015/02/14 15:13:24 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -164,7 +164,7 @@ BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) ret = 1; err: - if (r != rr) + if (r != rr && rr != NULL) BN_copy(r, rr); BN_CTX_end(ctx); bn_check_top(r); diff --git a/src/lib/libssl/src/crypto/bn/bn_exp.c b/src/lib/libssl/src/crypto/bn/bn_exp.c index eecab5163b..12de0c5a12 100644 --- a/src/lib/libssl/src/crypto/bn/bn_exp.c +++ b/src/lib/libssl/src/crypto/bn/bn_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_exp.c,v 1.20 2015/02/09 15:49:22 jsing Exp $ */ +/* $OpenBSD: bn_exp.c,v 1.21 2015/02/14 15:13:24 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -164,7 +164,7 @@ BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) ret = 1; err: - if (r != rr) + if (r != rr && rr != NULL) BN_copy(r, rr); BN_CTX_end(ctx); bn_check_top(r); -- cgit v1.2.3-55-g6feb