-
Rémi Denis-Courmont authored
The conversion from UTF-16 to UTF-8 could (until a few days ago) fail before the end. In that case, the appended nul terminator would not be converted. A nul terminator is anyway always appended after conversion and trimming. If conversion failed on the first character, that nul terminator would be written at a negative offset, leading to heap buffer "underflow" and memory corruption. This was fixed but lead to a mismatch in the value of i_lines depending on the character width. This change removes the useless pre-conversion nul terminator, and thus makes trimming work again with single byte character width work. This fixes reading text files formatted with MS-DOS line endings.
27849047