Upvote:7
The South Africa High Commission website states that you only need a transit visa through SA if you do not go through a port of entry (such as a land border). An airport is a port of entry. Thus, you should not need a transit visa to transfer in the airport, and you should not have to go through immigration.
Passport holders who want to transit a South African port of entry enroute to any other country, may do so without the need to apply for a transit visa.
Transit Visas are NOT issued at South African ports of entry.
I couldn't find anything official regarding sleeping in the airport, however, this blog post makes it seem fairly reasonable for you to stay there for 12 hours.