Skip to main content

rand_write_file

API Overview

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

Rule Description

tip

RAND_write_file() returns the number of bytes written, or -1 if the bytes written were generated without appropriate seeding.

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("RAND_write_file")
}
}

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