From bd7f4ef701ce5db64659db496d3f47aeedfadac2 Mon Sep 17 00:00:00 2001 From: mtortonesi Date: Tue, 9 Jan 2007 06:37:03 -0800 Subject: [PATCH] [svn] Fixed segfault if response text is missing --- src/ChangeLog | 4 ++++ src/ftp-basic.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5f137171..76f88a12 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2007-01-09 Steven M. Schweda + + * ftp-basic.c (ftp_syst): Fixed segfault if response text is missing. + 2006-12-29 Gisle Vanem * mswindows.c: Avoid a warning if 'ws_hangup()' is unused. diff --git a/src/ftp-basic.c b/src/ftp-basic.c index 851f5068..3a714078 100644 --- a/src/ftp-basic.c +++ b/src/ftp-basic.c @@ -1,5 +1,5 @@ /* Basic FTP routines. - Copyright (C) 1996-2006 Free Software Foundation, Inc. + Copyright (C) 1996-2007 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -1038,7 +1038,9 @@ ftp_syst (int csock, enum stype *server_type) first word of the server response)? */ request = strtok (NULL, " "); - if (!strcasecmp (request, "VMS")) + if (request == NULL) + *server_type = ST_OTHER; + else if (!strcasecmp (request, "VMS")) *server_type = ST_VMS; else if (!strcasecmp (request, "UNIX")) *server_type = ST_UNIX;