PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.73k stars 915 forks source link

dnslabeltext.rl assumes labellen is signed #10404

Open zeha opened 3 years ago

zeha commented 3 years ago

Short description

dnslabeltext.rl: In function ‘DNSName::string_t segmentDNSNameRaw(const char*, size_t)’:
dnslabeltext.rl:115:38: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  115 |                         if (labellen < 0 || labellen > 63) {
      |                             ~~~~~~~~~^~~
dnslabeltext.rl:115:38: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  115 |                         if (labellen < 0 || labellen > 63) {
      |                             ~~~~~~~~~^~~

labeltext is defined as char, but some platforms have char as unsigned.

I cannot tell if this is harmless or not.

Environment

Steps to reproduce

Build on arm64 / ppc64el / s390x, apparently :)

Other information

Logs:

Habbie commented 3 years ago

Some fun background at https://blog.powerdns.com/2013/10/28/on-ragel-and-char-types/