29class PutenvStackArrayChecker :
public Checker<check::PostCall> {
31 BugType BT{
this,
"'putenv' called with stack-allocated string",
40void PutenvStackArrayChecker::checkPostCall(
const CallEvent &
Call,
42 if (!Putenv.matches(
Call))
46 const Expr *ArgExpr =
Call.getArgExpr(0);
52 const auto *StackFrameFuncD =
53 dyn_cast_or_null<FunctionDecl>(SSR->getStackFrame()->getDecl());
54 if (StackFrameFuncD && StackFrameFuncD->isMain())
57 StringRef ErrorMsg =
"The 'putenv' function should not be called with "
58 "arrays that have automatic storage";
60 auto Report = std::make_unique<PathSensitiveBugReport>(BT, ErrorMsg, N);
65 C.emitReport(std::move(Report));
This represents one expression.
A CallDescription is a pattern that can be used to match calls based on the qualified name and the ar...
Represents an abstract call to a function or method along a particular path.
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemSpaceRegion * getMemorySpace() const
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
const MemRegion * getAsRegion() const
bool trackExpressionValue(const ExplodedNode *N, const Expr *E, PathSensitiveBugReport &R, TrackingOptions Opts={})
Attempts to add visitors to track expression value back to its point of origin.
const char *const SecurityError
The JSON file list parser is used to communicate input to InstallAPI.