Check sprintf for errors