Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.

llvm-svn: 94762
This commit is contained in:
Ted Kremenek 2010-01-28 23:56:52 +00:00
parent ab278de2d1
commit b5c98ef61e
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}
}