Use length guarded sprintf functions