mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 23:05:11 +00:00
parser: add uppercase hex on regex range generator
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
committed by
John Johansen
parent
a71ac76e6d
commit
fb5f59024c
@@ -888,8 +888,13 @@ static std::string generate_regex_range(bignum start, bignum end)
|
||||
bignum send = i.second;
|
||||
|
||||
for (j = sstart.size() - 1; j >= 0; j--) {
|
||||
result << std::nouppercase;
|
||||
if (sstart[j] == send[j]) {
|
||||
if (sstart[j] >= 10)
|
||||
result << '[';
|
||||
result << std::hex << sstart[j];
|
||||
if (sstart[j] >= 10)
|
||||
result << std::uppercase << std::hex << sstart[j] << ']';
|
||||
} else {
|
||||
if (sstart[j] < 10 && send[j] >= 10) {
|
||||
result << '[';
|
||||
@@ -903,12 +908,22 @@ static std::string generate_regex_range(bignum start, bignum end)
|
||||
result << '-';
|
||||
}
|
||||
result << std::hex << send[j];
|
||||
if (send[j] > 10) {
|
||||
result << 'A';
|
||||
result << '-';
|
||||
}
|
||||
result << std::uppercase << std::hex << send[j];
|
||||
result << ']';
|
||||
} else {
|
||||
result << '[';
|
||||
result << std::hex << sstart[j];
|
||||
result << '-';
|
||||
result << std::hex << send[j];
|
||||
if (sstart[j] >= 10) {
|
||||
result << std::uppercase << std::hex << sstart[j];
|
||||
result << '-';
|
||||
result << std::uppercase << std::hex << send[j];
|
||||
}
|
||||
result << ']';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user