(This is quite similar to [this question](http://meta.stackoverflow.com/a/266102/372643).) The first thing to do is to leave a comment and write your own alternative answer (if possible). In general, I wouldn't edit the code in an existing answer. Editing the code in an answer that is not yours can cause three problems: * You're saying you know better, but maybe you don't. From a neutral point of view, it's hard to say. * You're effectively changing the meaning of someone else's answer, that's not what edits are for. * To the casual reader who does go through the edit history, it looks like it comes from the initial answerer, which I'd say is rather unethical (especially, if instead of fixing something, you introduce a mistake). That said, if I felt sufficiently confident, I would edit the answer saying something at the top like "*[Editor's note: this is potentially insecure because XYZ]*": something short but sufficiently visible, and that makes it clear that the answer is disputed, and that the disagreement comes from a different user. (Users with sufficiently high reputation can see the details of +/- scores, which is useful to find out whether an answer is controversial, but many users can't see that.) I would still consider this type of editing as a last resort after leaving a comment on the answer and given a few days to the answerer to fix it if necessary.