Skip to main content

bn_ucmp

API Overview

BN_ucmp is an API in openssl. This rule belongs to the return value check type. This rule is generated using AURC.

Rule Description

tip

BN_cmp() returns -1 if I<a> E<lt> I<b>, 0 if I<a> == I<b> and 1 if I<a> E<gt> I<b>. BN_ucmp() is the same using the absolute values of I<a> and I<b>.

info
  • Tags: return value check
  • Parameter Index: N/A
  • CWE Type: CWE-253

Rule Code

import cpp

class OpenSSLFunctionCall extends FunctionCall {
OpenSSLFunctionCall() {
this.getTarget().hasName("BN_ucmp")
}
}

from OpenSSLFunctionCall call, UnaryOperation uop
where
uop.getOperator() = "!" and
uop.getOperand() = call.getAnAccess()
select uop, "This negation checks the return value of BN_ucmp."