SCP: Fixed potential out of bounds array reference while expanding command arguments.

Avoid race condition while producing debug header output from multiple threads.