Neither name_stream_connect_to_resolved_name() in af_name.c or find_answer_of_type() in dns.c seem to handle the possibility of a cname pointing to another cname.
Cnames pointing to cnames is recommended against in the specification, but are not considered to be errors.
Quoting RFC 1034 5.2.2
"Several special conditions can occur with aliases. Multiple levels of
aliases should be avoided due to their lack of efficiency, but should
not be signalled as an error. Alias loops and aliases which point to
non-existent names should be caught and an error condition passed back
to the client."
http://tools.ietf.org/html/rfc1034