Page MenuHomeFreeBSD

ee: Improve handling of malformed UTF-8 characters
ClosedPublic

Authored by markj on Wed, Jul 1, 4:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 28, 11:05 AM
Unknown Object (File)
Sat, Jul 25, 4:00 AM
Unknown Object (File)
Fri, Jul 24, 2:51 AM
Unknown Object (File)
Tue, Jul 21, 11:18 AM
Unknown Object (File)
Mon, Jul 20, 7:54 AM
Unknown Object (File)
Sat, Jul 18, 9:16 AM
Unknown Object (File)
Sat, Jul 18, 9:10 AM
Unknown Object (File)
Wed, Jul 15, 7:28 AM
Subscribers

Details

Summary

In delete(), when copying the deleted character to the d_char buffer,
don't assume that it fits. utf8_prev() may return a sequence of more
than 5 bytes.

In insert_utf8(), fix the copy-up of the line. We extended the line by
"len" bytes, so "temp" has to be repositioned accordingly. Compare with
plain insert().

Use sizeof when copying to buffers instead of hard-coding buffer sizes.

Don't dynamically allocate d_char, there is no need.

Fixes: 62fba0054d9e ("ee: add unicode support")
Reported by: Sayono Hiragi (overflow in delete())

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable