Hi Hans,

On Sat, 29 Feb 2020 19:10:02 +0100
Hans-Bernhard Bröker wrote:
> One more important note: the current implementation has a potential 
> buffer overrun issue, because it writes first, and only then checks 
> whether that may have overrun the buffer.  And the check itself is off 
> by one, too:
> 
> >    wpbuf[wpixput++] = x; \
> >    if (wpixput > WPBUF_LEN) \
> >     wpixput--; \
> 
> That's why my latest code snippet does it differently:
> 
>  >      if (ixput < WPBUF_LEN)
>  >        {
>  >          buf[ixput++] = x;
>  >        }

Indeed. You are right. Thanks for pointing out that.
Another similar problem exists in console code of escape
sequence handling, so I will submit a patch for that.

As for wpbuf, please continue to fix.

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>

Reply via email to