mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix a case sensitivity problem which has been lurking for a long while. When we get example.com and Example.com and combine them, we send whichever query arrives first upstream and then later answer it, and we also answer the second with the same answer. That means that if example.com arrives first, it will get the answer example.com - good - but Example.com will _also_ get the answer example.com - not so good. In theory, fixing this is simple without having to keep seperate copies of all the queries: Just use the bit-vector representation of case flipping that we have for 0x20-encoding to keep the differences in case. The complication comes from the fact that the existing bit-vector code only holds data on the first 32 alpha letters, because we only flip that up to many for 0x20 encoding. In practise, the delta between combined queries can almost always be represented with that data, since almost all queries are all lower case and we only purturb the first 32 letters with 0x20 encoding. It's therefore worth keeping the existing, efficient data structure for the 99.9% of the time it works. For the 0.1% it doesn't, however, one needs an arbitrary-length data structure with the resource implications of that. Thanks to Peter Tirsek for the well researched bug report which set me on to these problems.
123 KiB
123 KiB