diff options
author | Anna Zaks <ganna@apple.com> | 2013-04-10 22:06:29 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-04-10 22:06:29 +0000 |
commit | fececcbc3890955fd46f92036e9cb6ee7d0a60f4 (patch) | |
tree | 4659a7ad4bfd417105722deaa15492f267abaf91 /lib | |
parent | 7a87e520e42c1e58c358e3a9a436ef17f551fd13 (diff) |
[analyzer] Fix a crash in SyntaxCString checker when given a custom strncat.
Fixes PR13476
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp index 3a57a56aea..92c0eef3e8 100644 --- a/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp @@ -101,6 +101,8 @@ public: // - strncat(dst, src, sizeof(dst) - 1); // - strncat(dst, src, sizeof(dst)); bool WalkAST::containsBadStrncatPattern(const CallExpr *CE) { + if (CE->getNumArgs() != 3) + return false; const Expr *DstArg = CE->getArg(0); const Expr *SrcArg = CE->getArg(1); const Expr *LenArg = CE->getArg(2); |