Module Name: src
Committed By: martin
Date: Fri Sep 13 14:03:56 UTC 2024
Modified Files:
src/lib/libcurses [netbsd-10]: get_wch.c
Log Message:
Pull up following revision(s) (requested by rin in ticket #855):
lib/libcurses/get_wch.c: revision 1.27
Check for returning ERR to avoid negative array index later (CID-1617248)
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.2.1 src/lib/libcurses/get_wch.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcurses/get_wch.c
diff -u src/lib/libcurses/get_wch.c:1.26 src/lib/libcurses/get_wch.c:1.26.2.1
--- src/lib/libcurses/get_wch.c:1.26 Mon Sep 6 07:45:48 2021
+++ src/lib/libcurses/get_wch.c Fri Sep 13 14:03:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: get_wch.c,v 1.26 2021/09/06 07:45:48 rin Exp $ */
+/* $NetBSD: get_wch.c,v 1.26.2.1 2024/09/13 14:03:56 martin Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: get_wch.c,v 1.26 2021/09/06 07:45:48 rin Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.26.2.1 2024/09/13 14:03:56 martin Exp $");
#endif /* not lint */
#include <errno.h>
@@ -135,7 +135,7 @@ inkey(wchar_t *wc, int to, int delay)
}
c = __fgetc_resize(infd);
- if (ferror(infd)) {
+ if (c == ERR || ferror(infd)) {
clearerr(infd);
return c;
}
@@ -179,7 +179,7 @@ inkey(wchar_t *wc, int to, int delay)
}
c = __fgetc_resize(infd);
- if (ferror(infd)) {
+ if (c == ERR || ferror(infd)) {
clearerr(infd);
return c;
}