I'm surprised by the dominant response here, which goes against what the Stack Exchange guides advise and what seems to be widely practiced by editors. From the FAQ:
Like Wikipedia, this site is collaboratively edited, and all edits are tracked. If you are not comfortable with the idea of your questions and answers being edited by other trusted users, this may not be the site for you.
From the edit privilege guide:
Any time you feel you can make the post better, and are inclined to do so. Editing is encouraged!
Some common reasons to edit are:
- to fix grammatical or spelling mistakes
- to clarify the meaning of a post without changing it
- correct minor mistakes or add addendums / updates as the post ages
- add related resources or hyperlinks
From Jeff's blog post:
I’m proud to announce that we allow anonymous and new users to edit content in our system! The surface area of this change is huge — it means the millions of drive-by anonymous users that visit our sites every day can submit an improvement or correction.
So yes, if a post can be made better with an edit that changes its technical content from being broken to being correct, go ahead and make or suggest that edit!
In questions, this rarely arises if ever. But in answers, if the overall solution is good but there's a localized mistake somewhere, do fix it. A typical example is code that was typed directly in the browser, and doesn't compile: please do fix it into working code if you can. Another example is an answer that contains a major security problem, like an SQL injection: if correcting that is just a matter of adding proper escaping, please fix it.
To clarify the SQL injection example: I hold suggested edits to the same standards as normal edits. If the security of constructed SQL queries is the topic of the question and the answer contains vulnerable code, it's a wrong answer that should be downvoted, with a comment explaining the mistake (if the code is wrong, the accompanying explanation is presumably wrong too anyway — unless the error in the code is an obvious typo, in which case it should be fixed). If security was not a primary concern of the question, then the code should be fixed. We don't want examples of bad code to be left around unchecked.