lichray / nvi2

A multibyte fork of the nvi editor for BSD
Other
144 stars 34 forks source link

Fix segmentation fault when window size changes #96

Closed ueXIMcWizBrdyVEciAlSwxP8aaXP70mO closed 3 years ago

ueXIMcWizBrdyVEciAlSwxP8aaXP70mO commented 3 years ago

Platform: NixOS 20.09 Kernel: Linux 5.4.108 (x86_64-linux, glibc 2.31)

When widechar support is enabled, resizing the window causes a segmentation fault. This is caused by cl/cl_read.c:320 and cl/cl_read.c:323; with widechar support enabled, sizeof(b1) evaluates to 4096, while swprintf expects the destination buffer length to be in terms of widechar count.

I did not get the chance to test this on any machines other than my own. I am happy to provide additional details if needed.

lichray commented 3 years ago

Obviously correct; thanks!