If I were you, I wouldn’t worry about it. You were not gossiping. You aren’t at fault for other people’s gossip. Just don’t feed their gossip.
About the CCC, it teaches:
2477 Respect for the reputation of persons forbids every attitude and word likely to cause them unjust injury. He becomes guilty:
– of rash judgment who, even tacitly, assumes as true, without sufficient foundation, the moral fault of a neighbor;
– of detraction who, without objectively valid reason, discloses another’s faults and failings to persons who did not know them;
– of calumny who, by remarks contrary to the truth, harms the reputation of others and gives occasion for false judgments concerning them.
2478 To avoid rash judgment, everyone should be careful to interpret insofar as possible his neighbor’s thoughts, words, and deeds in a favorable way:
Every good Christian ought to be more ready to give a favorable interpretation to another’s statement than to condemn it. But if he cannot do so, let him ask how the other understands it. and if the latter understands it badly, let the former correct him with love. If that does not suffice, let the Christian try all suitable ways to bring the other to a correct interpretation so that he may be saved (Saint Ignatius of Loyola).
2479 Detraction and calumny destroy the reputation and honor of one’s neighbor. Honor is the social witness given to human dignity, and everyone enjoys a natural right to the honor of his name and reputation and to respect. Thus, detraction and calumny offend against the virtues of justice and charity.
Edit: I have read somewhere that gossiping becomes a mortal sin when the person A tells person B a gossip about person C, and as a result, Person B gets a bad impression of person C. Here the mortal sin falls into person A.