Skip to content

Commit

Permalink
Fix a few warnings found by compiler on MacOS, where char is unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
omoerbeek committed Jun 23, 2022
1 parent f5e76c2 commit abb8aeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pdns/dnslabeltext.rl
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ DNSName::string_t segmentDNSNameRaw(const char* realinput, size_t inputlen)
const char* eof = pe;
int cs;
char val = 0;
char labellen=0;
unsigned char labellen=0;
unsigned int lenpos=0;
%%{
action labelEnd {
if (labellen < 0 || labellen > 63) {
if (labellen > 63) {
throw runtime_error("Unable to parse DNS name '"+string(realinput)+"': invalid label length "+std::to_string(labellen));
}
ret[lenpos]=labellen;
Expand Down
4 changes: 2 additions & 2 deletions pdns/dnsname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ bool DNSName::isPartOf(const DNSName& parent) const
}
return true;
}
if (*us < 0) {
throw std::out_of_range("negative label length in dnsname");
if (static_cast<uint8_t>(*us) > 63) {
throw std::out_of_range("illegal label length in dnsname");
}
}
return false;
Expand Down

0 comments on commit abb8aeb

Please sign in to comment.