Cygwin: console: convert wpbuf_put to inline function

fix potential buffer overrun while at it

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2020-03-02 20:30:09 +01:00
parent b4bc238311
commit ecf27dd2e0
1 changed files with 7 additions and 4 deletions

View File

@ -63,10 +63,13 @@ static struct fhandler_base::rabuf_t con_ra;
static unsigned char wpbuf[WPBUF_LEN];
static int wpixput;
static unsigned char last_char;
#define wpbuf_put(x) \
wpbuf[wpixput++] = x; \
if (wpixput > WPBUF_LEN) \
wpixput--;
static inline void
wpbuf_put (unsigned char x)
{
if (wpixput < WPBUF_LEN)
wpbuf[wpixput++] = x;
}
static void
beep ()