Package: xjdic Version: 24-10 Severity: normal Tags: patch $ xjdic < /dev/null > /dev/null Segmentation fault
xjdic never checks the result of getchar() against EOF, resulting in an infinite loop, which eventually segfaults. The simplest solution is to check and exit in getcharxx(), before the result is cast to an unsigned integer. -- System Information: Debian Release: 9.0 APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.9.0-2-amd64 (SMP w/3 CPU cores) Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init)
>From 5a636e5298cb55b57b766f75f2f7f94dd19d7154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbri...@fbriere.net> Date: Thu, 16 Mar 2017 15:24:31 -0400 Subject: [PATCH] Exit on EOF --- xjdfrontend.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xjdfrontend.c b/xjdfrontend.c index 2104c3d..0e0eabc 100644 --- a/xjdfrontend.c +++ b/xjdfrontend.c @@ -305,7 +305,12 @@ int getcharxx() } else { - return(getchar()); + int c = getchar(); + if (c == EOF) + { + exit(0); + } + return(c); } } /*====GetWinSize==== Hank Cohen's routine for getting the (new) window size==*/ -- 2.11.0