From: Shanmugam S (shanms) Date: Fri, 10 Jun 2022 13:30:29 +0000 (+0000) Subject: Pull request #3469: ftp_telnet: handle all space characters as a separator between... X-Git-Tag: 3.1.32.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba23c9ebd6b731db24a0bd4af0c6ce0007ba4570;p=thirdparty%2Fsnort3.git Pull request #3469: ftp_telnet: handle all space characters as a separator between FTP request command and arguments Merge in SNORT/snort3 from ~ABHPAL/snort3:ftp_no_encrypt to master Squashed commit of the following: commit 4ef21c0f3c7b90b57c42d6075add9f80029e1ae4 Author: Abhijit Pal(abhpal) Date: Fri Jun 10 13:59:41 2022 +0530 ftp_telnet: handle all space characters as a seperator between FTP request command and arguments --- diff --git a/src/service_inspectors/ftp_telnet/pp_ftp.cc b/src/service_inspectors/ftp_telnet/pp_ftp.cc index 7c5458232..78284a79a 100644 --- a/src/service_inspectors/ftp_telnet/pp_ftp.cc +++ b/src/service_inspectors/ftp_telnet/pp_ftp.cc @@ -1334,7 +1334,6 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p, * */ #define NUL 0x00 -#define FF 0x0c #define CR 0x0d #define LF 0x0a #define SP 0x20 @@ -1395,9 +1394,7 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode) req->cmd_begin = (const char*)read_ptr; while ((read_ptr < end) && - (*read_ptr != SP) && - (*read_ptr != FF) && - (*read_ptr != CR) && + (!isspace(*read_ptr)) && (*read_ptr != LF) && /* Check for LF when there wasn't a CR, * protocol violation, but accepted by * some servers. */ @@ -1636,7 +1633,7 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode) if (read_ptr < end) { - if ((*read_ptr == SP) || (*read_ptr == FF)) + if (isspace(*read_ptr)) { space = 1; }