diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-01-28 23:56:52 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-01-28 23:56:52 +0000 |
commit | b5c98ef61eedfbf6d2fe7b1853310797f6a41f0f (patch) | |
tree | 3da666983356a5926d6bff38c938d8df2a9299d7 /clang/lib/Analysis/PrintfFormatString.cpp | |
parent | ab278de2d172e1954adc803e33ff5bb0694a47fe (diff) | |
download | bcm5719-llvm-b5c98ef61eedfbf6d2fe7b1853310797f6a41f0f.tar.gz bcm5719-llvm-b5c98ef61eedfbf6d2fe7b1853310797f6a41f0f.zip |
Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.
llvm-svn: 94762
Diffstat (limited to 'clang/lib/Analysis/PrintfFormatString.cpp')
-rw-r--r-- | clang/lib/Analysis/PrintfFormatString.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp index 544956ac411..986411fc7d2 100644 --- a/clang/lib/Analysis/PrintfFormatString.cpp +++ b/clang/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; } } |