commit db72774458151cfbf113f3177d0b2d39a6117f34
parent 3d727266c35679132f856a5aa9276baf2ae383d7
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 26 Feb 2024 10:40:47 +0100
verbatim: avoid referencing an uninitialized value
Only check input bytes when their count is nonzero.
This fixes https://savannah.gnu.org/bugs/?65365.
The issue was reported by `correctmost`.
The problem existed since version 5.7, commit c75a3839,
but occurred more easily since version 7.0, commit 75e5f885.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/winio.c b/src/winio.c
@@ -1539,7 +1539,7 @@ char *get_verbatim_kbinput(WINDOW *frame, size_t *count)
/* If the byte is invalid in the current mode, discard it;
* if it is an incomplete Unicode sequence, stuff it back. */
- if (input != NULL) {
+ if (input && *count) {
if (*input >= 0x80 && *count == 1) {
put_back(*input);
*count = 999;