Replaced printf with sprintf for thrown exception

Hello,

It looks that when throwing an exception **printf** is used, so the message gets outputed and the message length being thrown as exception message.

I replaced **printf** with **sprintf** so the correct message is thrown.

Thank you.