chiark / gitweb /
DNS packet parsing: Slight fix when packet is truncated
If the packet is truncated, adns__findrr_anychk returns adns_s_ok,
setting *type_r to -1. It does not guarantee to set the other
outputs.
So, in pap_findaddrs, check for this first, rather than perhaps
reading the uninitialised `ownermatched' value.
And in adns__procdgram check the type before checking the (technically
in this case undefined) class.
In practice there is no bug in actual compiled code, because in both
call sites another test will DTRT. I don't think contemporary
compilers spot and exploit this bug for "optimisation".
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>