[erlang-bugs] Potential endless loop in DNS resolver

Florian Weimer fw@REDACTED
Fri Jan 11 22:43:41 CET 2008


It seems to me that the following code from lib/kernel/src/inet_dns.erl
contains an endless loop:

dn_exp([N1,N2 | T], Buffer, Name) when N1 band ?INDIR_MASK =:= ?INDIR_MASK ->
    Offset = ((N1 band 16#3f) bsl 8) bor N2,
    case catch nthtail(Offset, Buffer) of
	{'EXIT', _} -> error;
	NDn -> 
	    %% We have to keep the Tail of original Dn in order to
	    %% prohibit ending up with the tail from an offset.
	    case dn_exp(NDn, Buffer, Name) of
		{ExpName, _} -> {ExpName, T};
		Res          -> Res
	    end
    end;

A compression reference which points to itself results in dn_exp being
called with the same argument over and over again.



More information about the erlang-bugs mailing list