read_key: fix buffer length calculation

Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Tomas Heinrich 2010-04-16 23:59:51 +02:00 committed by Denys Vlasenko
parent 36dcf4e516
commit 0358daf447

View File

@ -264,5 +264,5 @@ void FAST_FUNC read_key_ungets(char *buffer, const char *str, unsigned len)
if (len > KEYCODE_BUFFER_SIZE-1 - cur_len) if (len > KEYCODE_BUFFER_SIZE-1 - cur_len)
len = KEYCODE_BUFFER_SIZE-1 - cur_len; len = KEYCODE_BUFFER_SIZE-1 - cur_len;
memcpy(buffer + 1 + cur_len, str, len); memcpy(buffer + 1 + cur_len, str, len);
buffer[0] += cur_len + len; buffer[0] += len;
} }