aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/PrintfFormatString.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-28 23:56:52 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-28 23:56:52 +0000
commite729acbba75903f42e79e72e46cdebe3f4c35521 (patch)
treecb1ec1c88e744d503bacb4d738a2d4cdfb238e58 /lib/Analysis/PrintfFormatString.cpp
parente0e5313c25f3870d0d18fc67e1b3a3a0e1ef8e07 (diff)
Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94762 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PrintfFormatString.cpp')
-rw-r--r--lib/Analysis/PrintfFormatString.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index 544956ac41..986411fc7d 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/lib/Analysis/PrintfFormatString.cpp
@@ -89,16 +89,15 @@ static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
UpdateOnReturn <const char*> UpdateBeg(Beg, I);
// Look for a '%' character that indicates the start of a format specifier.
- while (I != E) {
+ for ( ; I != E ; ++I) {
char c = *I;
- ++I;
if (c == '\0') {
// Detect spurious null characters, which are likely errors.
H.HandleNullChar(I);
return true;
}
if (c == '%') {
- Start = I; // Record the start of the format specifier.
+ Start = I++; // Record the start of the format specifier.
break;
}
}