Re: [patch] mg: fix overflow on vteeol() (resend/bump)

2017-07-05 Thread Hiltjo Posthuma
On Sat, Jun 24, 2017 at 02:45:44PM +0200, Hiltjo Posthuma wrote:
> On Sun, Jun 18, 2017 at 03:04:31PM +0200, Hiltjo Posthuma wrote:
> > 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(' ');
> >  }
> >  
> >  /*
> > 
> 

Weekly *Bump!* Any feedback? :)

-- 
Kind regards,
Hiltjo



Re: [patch] mg: fix overflow on vteeol() (resend/bump)

2017-06-24 Thread Hiltjo Posthuma
On Sun, Jun 18, 2017 at 03:04:31PM +0200, Hiltjo Posthuma wrote:
> 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(' ');
>  }
>  
>  /*
> 

*Bump!* Any feedback? :)

-- 
Kind regards,
Hiltjo



[patch] mg: fix overflow on vteeol() (resend/bump)

2017-06-18 Thread Hiltjo Posthuma
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