From owner-svn-src-all@FreeBSD.ORG Mon Dec 20 19:07:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CEC91065751; Mon, 20 Dec 2010 19:07:57 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F067E8FC14; Mon, 20 Dec 2010 19:07:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBKJ7uln077162; Mon, 20 Dec 2010 19:07:56 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBKJ7uuc077160; Mon, 20 Dec 2010 19:07:56 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201012201907.oBKJ7uuc077160@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 20 Dec 2010 19:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216598 - head/games/factor X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Dec 2010 19:07:57 -0000 Author: uqs Date: Mon Dec 20 19:07:56 2010 New Revision: 216598 URL: http://svn.freebsd.org/changeset/base/216598 Log: factor(6): Check return values of BN_* functions. Coverity Prevent: CID 4862, 8771, 8772, 8773 Modified: head/games/factor/factor.c Modified: head/games/factor/factor.c ============================================================================== --- head/games/factor/factor.c Mon Dec 20 19:07:48 2010 (r216597) +++ head/games/factor/factor.c Mon Dec 20 19:07:56 2010 (r216598) @@ -211,7 +211,8 @@ pr_fact(BIGNUM *val) bnfact = BN_new(); BN_set_word(bnfact, *(fact - 1)); - BN_sqr(bnfact, bnfact, ctx); + if (!BN_sqr(bnfact, bnfact, ctx)) + errx(1, "error in BN_sqr()"); if (BN_cmp(bnfact, val) > 0 || BN_is_prime(val, PRIME_CHECKS, NULL, NULL, NULL) == 1) @@ -271,7 +272,8 @@ pollard_pminus1(BIGNUM *val) BN_set_word(rbase, 1); newbase: - BN_add_word(rbase, 1); + if (!BN_add_word(rbase, 1)) + errx(1, "error in BN_add_word()"); BN_set_word(i, 2); BN_copy(base, rbase); @@ -282,7 +284,8 @@ newbase: BN_copy(x, base); BN_sub_word(x, 1); - BN_gcd(x, x, val, ctx); + if (!BN_gcd(x, x, val, ctx)) + errx(1, "error in BN_gcd()"); if (!BN_is_one(x)) { if (BN_is_prime(x, PRIME_CHECKS, NULL, NULL, @@ -303,7 +306,8 @@ newbase: } BN_copy(val, num); } - BN_add_word(i, 1); + if (!BN_add_word(i, 1)) + errx(1, "error in BN_add_word()"); } }