Prime 95 is good for testing cpu or cpu and ram combination. I have used the software, but I usually don't do overnight test. 3 to 6 hours is what I do do. Your bios may have temp alarm and or shutdown.
There are other utilities as mentioned above.
Going back to overnight test for myself. I do not do them because
I think its a waste of energy, hard use on puter, and if monitoring software not working correct or something goes wrong the stress could cause permenant damge to PC.