Hey,

This is a resend/bump of a patch about a month ago, can it get applied?

Original message below:


mg crashes with certain (unicode) characters and moving the cursor to the
end of the line.

The characters are printed to the screen as \nnn in vtpute() and vtcol is
updated, however vteeol() will write beyond the buffer.

A test file contains the data:

——————————————————

It is printed to the screen as: \342\200\224\342... etc.

It is safer to use vtpute() here because it checks if vtcol >= 0.

Below is a patch:


diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c
index 7af723ce268..d7c22554753 100644
--- a/usr.bin/mg/display.c
+++ b/usr.bin/mg/display.c
@@ -381,11 +381,8 @@ vtpute(int c)
 void
 vteeol(void)
 {
-       struct video *vp;
-
-       vp = vscreen[vtrow];
        while (vtcol < ncol)
-               vp->v_text[vtcol++] = ' ';
+               vtpute(' ');
 }
 
 /*

-- 
Kind regards,
Hiltjo

Reply via email to