Hilchos Lashon Hara chapter 6, section 3

How can one know if one may listen to lashon hara? If a person wants to speak of someone and one understands he wants to denigrate him, once should immediately ask the speaker if the matter is relevant to oneself or if one will be able to rebuke the person spoken of. In such a case one may listen. Otherwise one may not.