summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-06-26 02:54:24 +0000
committerbrian <brian@FreeBSD.org>1999-06-26 02:54:24 +0000
commit909ee378b759d58c5e58ab3593c53ae6ce3f4225 (patch)
treec03d7e0f0d1644df5a6c04208e73e8503715ce30 /usr.sbin/ppp/chat.c
parent5b58f2f951911f1075788268f99efccf1dba60eb (diff)
downloadFreeBSD-src-909ee378b759d58c5e58ab3593c53ae6ce3f4225.zip
FreeBSD-src-909ee378b759d58c5e58ab3593c53ae6ce3f4225.tar.gz
If we run out of chat script immediately after a successfully executed
expect-send-expect sequence, finish gracefully, don't core dump. This bug has been there for over a year - I could never reproduce it ! Straw provided by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r--usr.sbin/ppp/chat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c
index 6a038e9..9e9fa17 100644
--- a/usr.sbin/ppp/chat.c
+++ b/usr.sbin/ppp/chat.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: chat.c,v 1.56 1999/05/27 09:50:10 brian Exp $
+ * $Id: chat.c,v 1.57 1999/06/09 08:47:31 brian Exp $
*/
#include <sys/param.h>
@@ -181,7 +181,11 @@ chat_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
} else {
int minus;
- c->argptr = c->argv[++c->arg];
+ if ((c->argptr = c->argv[++c->arg]) == NULL) {
+ /* End of script - all ok */
+ c->state = CHAT_DONE;
+ return 0;
+ }
if (c->state == CHAT_EXPECT) {
/* Look for expect-send-expect sequence */
OpenPOWER on IntegriCloud