Added "id_idx" parameter to CheckPrintfArguments. This will be used

by CheckPrintfArguments to determine if a given printf function
accepts a va_arg argument.

llvm-svn: 41008
This commit is contained in:
Ted Kremenek 2007-08-10 21:21:05 +00:00
parent d36d30b53c
commit 56c864e3fd
2 changed files with 7 additions and 5 deletions

View File

@ -426,8 +426,9 @@ private:
void CheckFunctionCall(Expr *Fn, FunctionDecl *FDecl,
Expr** Args, unsigned NumArgsInCall);
void CheckPrintfArguments(Expr *Fn, FunctionDecl *FDecl, unsigned format_idx,
Expr** Args, unsigned NumArgsInCall);
void CheckPrintfArguments(Expr *Fn, unsigned id_idx, FunctionDecl *FDecl,
unsigned format_idx, Expr** Args,
unsigned NumArgsInCall);
};

View File

@ -57,7 +57,7 @@ Sema::CheckFunctionCall(Expr *Fn, FunctionDecl *FDecl,
case id_vsprintf: format_idx = 1; break;
case id_vprintf: format_idx = 1; break;
}
CheckPrintfArguments(Fn, FDecl, format_idx, Args, NumArgsInCall);
CheckPrintfArguments(Fn, i, FDecl, format_idx, Args, NumArgsInCall);
}
}
@ -70,8 +70,9 @@ Sema::CheckFunctionCall(Expr *Fn, FunctionDecl *FDecl,
/// FormatGuard: Automatic Protection From printf Format String
/// Vulnerabilities, Proceedings of the 10th USENIX Security Symposium, 2001.
void
Sema::CheckPrintfArguments(Expr *Fn, FunctionDecl *FDecl, unsigned format_idx,
Expr** Args, unsigned NumArgsInCall) {
Sema::CheckPrintfArguments(Expr *Fn, unsigned id_idx, FunctionDecl *FDecl,
unsigned format_idx, Expr** Args,
unsigned NumArgsInCall) {
assert( format_idx < NumArgsInCall );