There are all sort of coding best practices to prevent stack overflow attack but that is not what this question is about. What I want to know is how to prevent a legit non-admin user running a piece of code that will deliberately cause stack/heap overflow to gain admin access? What can a system admin can do to block such attempts? I know DEP being one method but from what I read it can't stop all attacks.
My focus is Windows systems.