Use number of chars written instead of strlen in msi_cmp().