Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[qtcontacts-sqlite] Validate characters in dial string if required
Even if the dial string is not required, the content should be
validated.
  • Loading branch information
matthewvogt committed Aug 20, 2013
1 parent 5b00ac8 commit 39c9b52
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/extensions/qtcontacts-extensions_impl.h
Expand Up @@ -89,7 +89,16 @@ QString normalize(const QString &input, int flags, int maxCharacters)
}
} else if (dtmfChars.contains(*it)) {
if ((flags & QtContactsSqliteExtensions::KeepPhoneNumberDialString) == 0) {
// No need to continue
// No need to continue accumulating
if (flags & QtContactsSqliteExtensions::ValidatePhoneNumber) {
// Ensure the remaining characters are permissible
while (++it != end) {
if ((!(*it).isDigit()) && !allowedSeparators.contains(*it) && !dtmfChars.contains(*it)) {
// Invalid character
return QString();
}
}
}
break;
} else if (firstDtmfIndex == -1) {
firstDtmfIndex = subset.length();
Expand Down

0 comments on commit 39c9b52

Please sign in to comment.