diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-01 12:53:45 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-01 12:53:45 +0100 |
commit | 70f261a24c2c0827827cf226f77c774136489cc5 (patch) | |
tree | fb7c85e5ccbbcb773ee25af8ff66afa90780369b | |
parent | Validate UTF-8 encoding and check for long lines (diff) | |
download | makel-70f261a24c2c0827827cf226f77c774136489cc5.tar.gz makel-70f261a24c2c0827827cf226f77c774136489cc5.tar.bz2 makel-70f261a24c2c0827827cf226f77c774136489cc5.tar.xz |
Fix replacement character insertion for invalid UTF-8
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | text.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -115,7 +115,8 @@ check_utf8_encoding(struct line *line) &line->data[off + r], line->len - off - r); memcpy(&line->data[off], invalid_codepoint_encoding, ELEMSOF(invalid_codepoint_encoding)); - line->len = line->len - r + ELEMSOF(invalid_codepoint_encoding); + line->len -= r; + line->len += r = ELEMSOF(invalid_codepoint_encoding); } } } |