Disallow non-ASCII and ASCII control characters in FAT label

FAT label is interpreted according to current OEM DOS codepage which is
system dependent setting. But most DOS codepages have same characters in
printable ASCII range, so this is the only safe range of characters which
are interpreted in same way by most programs and operating systems. Also
all DOS codepages are only 8bit, so characters above U+FF cannot be stored
to FAT label.
This commit is contained in:
Pali Rohár 2017-09-26 22:41:16 +02:00 committed by Andrius Štikonas
parent 5a30aff288
commit e957c220bd
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ int fat16::maxLabelLength() const
QValidator* fat16::labelValidator(QObject *parent) const
{
QRegularExpressionValidator *m_LabelValidator = new QRegularExpressionValidator(parent);
m_LabelValidator->setRegularExpression(QRegularExpression(QStringLiteral(R"(^[^*?.,;:\/\\|+=<>\[\]"]*$)")));
m_LabelValidator->setRegularExpression(QRegularExpression(QStringLiteral(R"(^[^\x{0000}-\x{001F}\x{007F}-\x{FFFF}*?.,;:\/\\|+=<>\[\]"]*$)")));
return m_LabelValidator;
}