From cd425e52a52e20b87cf9a7cd1d5ce5a75f86e3e4 Mon Sep 17 00:00:00 2001
From: inoguchi <>
Date: Thu, 20 Jan 2022 10:53:33 +0000
Subject: Add check for BN functions return value

CID 21665 24835

comment from jsing@ and tb@
ok jsing@ millert@ tb@
---
 src/lib/libcrypto/bn/bn_print.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c
index d849b860f9..9b5c753316 100644
--- a/src/lib/libcrypto/bn/bn_print.c
+++ b/src/lib/libcrypto/bn/bn_print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_print.c,v 1.32 2021/08/31 11:19:19 tb Exp $ */
+/* $OpenBSD: bn_print.c,v 1.33 2022/01/20 10:53:33 inoguchi Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -310,8 +310,10 @@ BN_dec2bn(BIGNUM **bn, const char *a)
 		l += *a - '0';
 		a++;
 		if (++j == BN_DEC_NUM) {
-			BN_mul_word(ret, BN_DEC_CONV);
-			BN_add_word(ret, l);
+			if (!BN_mul_word(ret, BN_DEC_CONV))
+				goto err;
+			if (!BN_add_word(ret, l))
+				goto err;
 			l = 0;
 			j = 0;
 		}
-- 
cgit v1.2.3-55-g6feb