South Africa have been penalised five runs for ball tampering during the third day of the second Test against Pakistan in Dubai.