[PATCH v2 1/4] Cygwin: console: Add workaround for broken IL/DL in xterm mode.
Takashi Yano
takashi.yano@nifty.ne.jp
Sun Mar 1 06:39:00 GMT 2020
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.yano@nifty.ne.jp>
More information about the Cygwin-patches
mailing list