If I am messing around with pointers and using a modern operating system (xubuntu zesty) is there any danger of overwriting memory outside of the program or will default memory protections always prevent this?


I'd say no. Due to process isolation, every process only sees their own virtual memory block and can not access anything outside that.

See e.g. http://www.tldp.org/LDP/khg/HyperNews/get/memory/linuxmm.html and http://www.tldp.org/LDP/tlk/mm/memory.html for more information about memory management.

However, this only restricts the application from accidentally accessing memory it should not be touching, e.g. because of a wrongly set pointer (in C programs). The application could still issue system commands to access any hardware, including the full RAM, if it is running as root and explicitly written to do this. You wouldn't have to fear about such a thing if you write your own program though.

Not the answer you're looking for? Browse other questions tagged or ask your own question.