"even though i wasnt interested in hearing yet he kept telling me. I didnt ask him"
You never said that. Please re-read your original post. From what you wrote, it sounded like you were keeping tabs on your ex.
From the new information you just shared ~
When his friend starts talking about him, stop the conversation immediately and tell him you don't want to hear it. If he won't let up, get up and leave the room. Maybe you need to cut off contact with this person completely, if he doesn't respect your wishes to NOT hear about your ex.
"And what gives YOU the right to pass stupid comments about me?"
You asked. If you don't want to hear what people have to say, don't ask them for their opinion.