Date: Mon, 19 Nov 2007 14:44:26 +0200 (EET) From: hsu@bbnetworks.net To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/118123: /usr/bin/chat has infinite recursion bug Message-ID: <200711191244.lAJCiQdZ002255@ranta.suonsivu.net> Resent-Message-ID: <200711191350.lAJDo1bY050663@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 118123
>Category: bin
>Synopsis: /usr/bin/chat has infinite recursion bug
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Nov 19 13:50:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: Heikki Suonsivu <hsu@bbnetworks.net>
>Release: FreeBSD 7.0-BETA3 i386
>Organization:
bbnetworks.net
>Environment:
System: FreeBSD ranta.suonsivu.net 7.0-BETA3 FreeBSD 7.0-BETA3 #2: Mon Nov 19 12:35:21 EET 2007 hsu@joutseno.wlansystems.com:/usr/obj/usr/src/sys/EBOX2300 i386
RELENG_6 and RELENG_7
>Description:
chat will enter to infinite recursion if the tty disappears.
This happens when a mobile phone disconnects during chat.
>How-To-Repeat:
Connect a mobile phone or other usb serial device, and unplug
it when pppd is running chat.
>Fix:
--- chat.c.~1.21.~ Fri Oct 31 08:22:03 2003
+++ chat.c Sun Nov 4 12:02:43 2007
@@ -439,6 +439,22 @@
terminate(code);
}
+/* As above, but does not call terminate. This is for functions which
+ need to handle termination themselves, such as terminate(). */
+
+void
+fatal_no_terminate(int code, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vfmtmsg(line, sizeof(line), fmt, args);
+ if (to_log)
+ syslog(LOG_ERR, "%s", line);
+ if (to_stderr)
+ fprintf(stderr, "%s\n", line);
+}
+
int alarmed = 0;
SIGTYPE sigalrm(int signo __unused)
@@ -547,8 +563,10 @@
#if defined(get_term_param)
if (have_tty_parameters) {
- if (set_term_param (&saved_tty_parameters) < 0)
- fatal(2, "Can't restore terminal parameters: %m");
+ if (set_term_param (&saved_tty_parameters) < 0) {
+ fatal_no_terminate(2, "Can't restore terminal parameters: %m");
+ status = 2;
+ }
}
#endif
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711191244.lAJCiQdZ002255>
