LWN.net Logo

Potential pitfalls in DNS handling

Potential pitfalls in DNS handling

Posted Nov 16, 2012 23:54 UTC (Fri) by Comet (subscriber, #11646)
In reply to: Potential pitfalls in DNS handling by hawk
Parent article: Potential pitfalls in DNS handling

The bind library does.

That doesn't stop people writing code like:

labels = result.split('.')
shorthost = labels[0]

If you split on '.', then you break when presented with the escaped form '\.' as you'll do an extra split. You might get away with it when only looking for the TLD, or just sorting data and rejoining the strings.

So, there's an escaping mechanism, it helps a lot of the time, but other times it produces surprising results and you need to at least know that the escaping mechanism is in use.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds