From: hno <> Date: Tue, 2 Jan 2007 04:40:33 +0000 (+0000) Subject: Bug #1857: Segmentation fault when accessing certain ftp:// URLs X-Git-Tag: SQUID_3_0_PRE6~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4528993542bb7350b249c5bcb6eb019f6ef0a1a5;p=thirdparty%2Fsquid.git Bug #1857: Segmentation fault when accessing certain ftp:// URLs --- diff --git a/src/ftp.cc b/src/ftp.cc index c5fb7f4497..cd70c4d494 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.408 2006/10/31 23:30:57 wessels Exp $ + * $Id: ftp.cc,v 1.409 2007/01/01 21:40:33 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -598,7 +598,7 @@ FtpStateData::listingFinish() flags.dir_slash ? rfc1738_escape_part(old_filepath) : "."); } else if (typecode == 'D') { const char *path = flags.dir_slash ? filepath : "."; - printfReplyBody("[As extended directory]\n", html_quote(path)); + printfReplyBody("[As extended directory]\n", rfc1738_escape_part(path)); } printfReplyBody("
\n"); @@ -918,8 +918,8 @@ FtpStateData::htmlifyListEntry(const char *line) return html; } - if (flags.dir_slash) - snprintf(prefix, sizeof(prefix), "%s/", rfc1738_escape_part(dirpath)); + if (flags.dir_slash && dirpath && typecode != 'D') + snprintf(prefix, 2048, "%s/", rfc1738_escape_part(dirpath)); else prefix[0] = '\0';