[ldns-users] trailing garbage in wire parser

Robert Edmonds edmonds at debian.org
Sun Sep 6 18:12:02 UTC 2009

Jelte Jansen wrote:
> robert edmonds brought to my attention something that might or might not be a
> problem in ldns; the wire parser does not error if there is trailing garbage
> after a dns packet. One could very well say that that is not supposed to happen
> and an error should be raised.
> Here's a small patch that does that. Although even if included, there is one
> more choice to be made; should the packet be freed and NULL returned, or should
> the packet be kept in case the one asking for the parsing still wants to have
> it? (depends on whether callers check for *pkt == NULL or return value ==
> LDNS_STATUS_OK to decide whether or not the pkt should be free'd later, i think
> both ways are used by developers) It now does the latter, but freeing it is
> probably more consistent, if an error is returned.

the documentation for ldns_wire2pkt() unfortunately doesn't make it
explicit if *pkt is always allocated, or only on LDNS_STATUS_OK.

bert hubert wrote:
> Ok, on trailing garbage, this is rife on the internet. PowerDNS used
> to error out on it, but it was not doable.

really?  do you have any current numbers?  i've only been able to find a
few packets with trailing garbage, but maybe my sample is biased.

Robert Edmonds
edmonds at debian.org

More information about the ldns-users mailing list