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

View File

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