54 #define FTP_MPM mpm_default_matcher
56 static MpmCtx *ftp_mpm_ctx = NULL;
66 static uint32_t ftp_max_preliminary_responses = 16;
73 static void FTPParseMemcap(
void)
76 &ftp_max_preliminary_responses);
82 static void FTPIncrMemuse(uint64_t size)
87 static void FTPDecrMemuse(uint64_t size)
120 static int FTPCheckMemcap(uint64_t size)
128 static void *FTPCalloc(
size_t n,
size_t size)
130 if (FTPCheckMemcap((uint32_t)(n * size)) == 0) {
142 FTPIncrMemuse((uint64_t)(n * size));
146 static void *FTPRealloc(
void *ptr,
size_t orig_size,
size_t size)
149 if (size > orig_size && FTPCheckMemcap(size - orig_size) == 0) {
160 if (size > orig_size) {
161 FTPIncrMemuse(size - orig_size);
163 FTPDecrMemuse(orig_size - size);
169 static void FTPFree(
void *ptr,
size_t size)
173 FTPDecrMemuse((uint64_t)size);
180 FTPIncrMemuse(response->total_size);
189 FTPDecrMemuse(wrapper->
response->total_size);
190 SCFTPFreeResponseLine(wrapper->
response);
196 static void *FTPLocalStorageAlloc(
void)
205 if (td->
pmq == NULL) {
218 static void FTPLocalStorageFree(
void *ptr)
222 if (td->
pmq != NULL) {
263 SCLogDebug(
"new transaction %p (state tx cnt %"PRIu64
")", tx, state->
tx_cnt);
278 while ((wrapper =
TAILQ_FIRST(&tx->response_list))) {
280 FTPResponseWrapperFree(wrapper);
283 FTPFree(tx,
sizeof(*tx));
301 while (input->
len > 0) {
302 const uint8_t *lf_idx = memchr(input->
buf + input->
consumed, 0x0a, input->
len);
304 if (lf_idx == NULL) {
306 *current_line_truncated =
true;
320 const uint32_t o_consumed = input->
consumed;
321 input->
consumed = (uint32_t)(lf_idx - input->
buf + 1);
322 const uint32_t line_len = (uint32_t)(input->
consumed - o_consumed);
323 input->
len -= (int32_t)line_len;
326 if (*current_line_truncated) {
330 *current_line_truncated =
false;
334 line->
buf = input->
buf + o_consumed;
335 line->
len = line_len;
371 static int FTPParseRequestCommand(
382 uint8_t command_code;
383 if (SCGetFtpCommandInfo(td->
pmq->
rule_id_array[0], NULL, &command_code, NULL)) {
394 const char *command_name = NULL;
395 (void)SCGetFtpCommandInfo(td->
pmq->
rule_id_array[0], &command_name, NULL, NULL);
396 SCLogDebug(
"matching FTP command is %s [code: %d, index %d]", command_name,
406 static void FtpTransferCmdFree(
void *data)
408 FtpTransferCmd *cmd = (FtpTransferCmd *)data;
411 if (cmd->file_name) {
412 FTPFree((
void *)cmd->file_name, cmd->file_len + 1);
414 SCFTPTransferCmdFree(cmd);
415 FTPDecrMemuse((uint64_t)
sizeof(FtpTransferCmd));
418 static uint32_t CopyCommandLine(uint8_t **dest,
FtpLineState *line)
422 while (line->
len && isspace((
unsigned char)line->
buf[line->
len - 1])) {
430 uint8_t *where = FTPCalloc(line->
len + 1,
sizeof(
char));
434 memcpy(where, line->
buf, line->
len);
435 where[line->
len] =
'\0';
438 return line->
len + 1;
460 const uint8_t *input = StreamSliceGetData(&stream_slice);
461 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
465 }
else if (input == NULL || input_len == 0) {
469 FtpInput ftpi = { .
buf = input, .len = input_len, .orig_len = input_len, .consumed = 0 };
470 FtpLineState line = { .
buf = NULL, .len = 0, .delim_len = 0, .truncated =
false };
472 uint8_t direction = STREAM_TOSERVER;
478 }
else if (res.
status == -1) {
483 if (!FTPParseRequestCommand(thread_data, &line, &cmd_descriptor)) {
484 state->
command = FTP_COMMAND_UNKNOWN;
508 (state->
command == FTP_COMMAND_STOR || state->
command == FTP_COMMAND_APPE ||
509 state->
command == FTP_COMMAND_STOU)) ||
511 (state->
command == FTP_COMMAND_RETR || state->
command == FTP_COMMAND_NLST ||
512 state->
command == FTP_COMMAND_LIST ||
513 state->
command == FTP_COMMAND_MLSD))) {
514 direction = STREAM_TOCLIENT;
517 bool has_file =
false;
520 case FTP_COMMAND_EPRT:
522 case FTP_COMMAND_PORT:
541 case FTP_COMMAND_RETR:
543 case FTP_COMMAND_STOR:
545 case FTP_COMMAND_APPE:
556 case FTP_COMMAND_STOU:
561 case FTP_COMMAND_NLST:
562 case FTP_COMMAND_LIST:
563 case FTP_COMMAND_MLSD: {
570 FtpTransferCmd *data = SCFTPTransferCmdNew();
573 FTPIncrMemuse((uint64_t)(
sizeof *data));
575 data->flow_id = FlowGetId(
f);
576 data->direction = direction;
577 data->data_free = FtpTransferCmdFree;
585 #if SC_FILENAME_MAX > UINT16_MAX
586 #error SC_FILENAME_MAX is greater than UINT16_MAX
588 data->file_name = FTPCalloc(file_name_len + 1,
sizeof(
char));
589 if (data->file_name == NULL) {
590 FtpTransferCmdFree(data);
593 data->file_name[file_name_len] = 0;
594 data->file_len = (uint16_t)file_name_len;
595 memcpy(data->file_name, line.
buf + 5, file_name_len);
596 }
else if (state->
command == FTP_COMMAND_STOU) {
597 const char default_file_name[] =
"<stou>";
598 uint32_t file_name_len =
sizeof(default_file_name);
599 data->file_name = FTPCalloc(file_name_len,
sizeof(
char));
600 if (data->file_name == NULL) {
601 FtpTransferCmdFree(data);
604 data->file_name[file_name_len - 1] = 0;
605 data->file_len = (uint16_t)file_name_len - 1;
606 memcpy(data->file_name, default_file_name, file_name_len);
611 FtpTransferCmdFree(data);
615 SCLogDebug(
"Expectation created [direction: %s, dynamic port %" PRIu16
"].",
635 static int FTPParsePassiveResponse(
FtpState *state,
const uint8_t *input, uint32_t input_len)
637 uint16_t dyn_port = SCFTPParsePortPasv(input, input_len);
641 SCLogDebug(
"FTP passive mode (v4): dynamic port %"PRIu16
"", dyn_port);
650 static int FTPParsePassiveResponseV6(
FtpState *state,
const uint8_t *input, uint32_t input_len)
652 uint16_t dyn_port = SCFTPParsePortEpsv(input, input_len);
656 SCLogDebug(
"FTP passive mode (v6): dynamic port %"PRIu16
"", dyn_port);
673 static inline bool FTPIsPPR(
const uint8_t *input, uint32_t input_len)
675 return input_len >= 4 && isdigit(input[0]) && input[0] ==
'1' &&
676 isdigit(input[1]) && isdigit(input[2]) && isspace(input[3]);
693 const uint8_t *input = StreamSliceGetData(&stream_slice);
694 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
699 FtpInput ftpi = { .
buf = input, .len = input_len, .orig_len = input_len, .consumed = 0 };
700 FtpLineState line = { .
buf = NULL, .len = 0, .delim_len = 0, .truncated =
false };
708 }
else if (res.
status == -1) {
713 tx = FTPTransactionCreate(state);
724 if (state->
command == FTP_COMMAND_UNKNOWN) {
731 const bool ppr = FTPIsPPR(line.
buf, line.
len);
734 case FTP_COMMAND_AUTH_TLS:
740 case FTP_COMMAND_EPRT:
749 SCLogDebug(
"FTP active mode (v6): dynamic port %" PRIu16
"", dyn_port);
752 case FTP_COMMAND_PORT:
761 SCLogDebug(
"FTP active mode (v4): dynamic port %" PRIu16
"", dyn_port);
764 case FTP_COMMAND_PASV:
766 FTPParsePassiveResponse(ftp_state, line.
buf, line.
len);
770 case FTP_COMMAND_EPSV:
772 FTPParsePassiveResponseV6(ftp_state, line.
buf, line.
len);
780 if (!AppLayerDecoderEventsIsEventSet(
786 if (line.
truncated && !AppLayerDecoderEventsIsEventSet(
792 FTPResponseLine *response = SCFTPParseResponseLine((
const char *)line.
buf, line.
len);
797 if (response->truncated) {
806 SCFTPFreeResponseLine(response);
809 SCLogDebug(
"unable to parse FTP response line \"%s\"", line.
buf);
828 static uint64_t ftp_state_memuse = 0;
829 static uint64_t ftp_state_memcnt = 0;
832 static void *FTPStateAlloc(
void *orig_state,
AppProto proto_orig)
834 void *s = FTPCalloc(1,
sizeof(
FtpState));
850 static void FTPStateFree(
void *s)
861 const char *command_name = NULL;
862 (void)SCGetFtpCommandInfo(
864 SCLogDebug(
"[%s] state %p id %" PRIu64
", Freeing %d bytes at %p",
870 FTPTransactionFree(tx);
893 SCLogDebug(
"NULL state object; no transactions available");
910 SCLogDebug(
"Returning OLDEST tx %p id %"PRIu64, lasttx, lasttx->
tx_id);
914 static void *FTPGetTx(
void *state, uint64_t tx_id)
920 if (ftp_state->
curr_tx == NULL)
926 if (tx->
tx_id == tx_id)
945 static void FTPStateTransactionFree(
void *state, uint64_t tx_id)
950 if (tx_id < tx->tx_id)
952 else if (tx_id > tx->
tx_id)
958 FTPTransactionFree(tx);
963 static uint64_t FTPGetTxCnt(
void *state)
974 static int FTPGetAlstateProgress(
void *vtx, uint8_t direction)
980 if (direction == STREAM_TOSERVER) {
981 return FTP_STATE_FINISHED;
984 return FTP_STATE_IN_PROGRESS;
987 return FTP_STATE_FINISHED;
990 static AppProto FTPUserProbingParser(
991 const Flow *
f, uint8_t direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
1004 static AppProto FTPQuitProbingParser(
1005 const Flow *
f, uint8_t direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
1012 if (
SCMemcmp(input,
"QUIT", 4) != 0) {
1018 static AppProto FTPServerProbingParser(
1019 const Flow *
f, uint8_t direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
1026 if (input[0] !=
'2' || input[1] !=
'2' || input[2] !=
'0') {
1030 if (input[3] !=
' ' && input[3] !=
'-') {
1036 if (memchr(input + 4,
'\n',
len - 4) != NULL) {
1043 static int FTPRegisterPatternsForProtocolDetection(
void)
1046 IPPROTO_TCP,
ALPROTO_FTP,
"220 (", 5, 0, STREAM_TOCLIENT) < 0) {
1050 IPPROTO_TCP,
ALPROTO_FTP,
"FEAT", 4, 0, STREAM_TOSERVER) < 0) {
1054 STREAM_TOSERVER, FTPUserProbingParser, 5, 5) < 0) {
1059 IPPROTO_TCP,
ALPROTO_FTP,
"PORT ", 5, 0, STREAM_TOSERVER) < 0) {
1065 "tcp", IPPROTO_TCP,
"ftp",
ALPROTO_FTP, 0, 5, NULL, FTPServerProbingParser)) {
1069 FTPQuitProbingParser, FTPServerProbingParser);
1087 const uint8_t *input = StreamSliceGetData(&stream_slice);
1088 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
1089 const bool eof = (direction & STREAM_TOSERVER)
1095 ftpdata_state->
tx_data.
file_tx = direction & (STREAM_TOSERVER | STREAM_TOCLIENT);
1096 if (direction & STREAM_TOSERVER) {
1105 SCLogDebug(
"FTP-DATA input_len %u flags %04x dir %d/%s EOF %s", input_len,
flags, direction,
1106 (direction & STREAM_TOSERVER) ?
"toserver" :
"toclient", eof ?
"true" :
"false");
1110 FtpTransferCmd *data =
1117 if ((direction & data->direction) == 0) {
1119 SCLogDebug(
"input %u not for our direction (%s): %s/%s", input_len,
1120 (direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
1121 data->cmd == FTP_COMMAND_STOR ?
"STOR" :
"RETR",
1122 (data->direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1126 if (data->file_name) {
1128 if (ftpdata_state->
files == NULL) {
1133 ftpdata_state->
file_name = data->file_name;
1134 ftpdata_state->
file_len = data->file_len;
1135 data->file_name = NULL;
1139 ftpdata_state->
command = data->cmd;
1140 switch (data->cmd) {
1141 case FTP_COMMAND_STOR:
1142 ftpdata_state->
direction = data->direction;
1144 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1146 case FTP_COMMAND_APPE:
1147 ftpdata_state->
direction = data->direction;
1149 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1151 case FTP_COMMAND_STOU:
1152 ftpdata_state->
direction = data->direction;
1154 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1156 case FTP_COMMAND_RETR:
1157 ftpdata_state->
direction = data->direction;
1159 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1161 case FTP_COMMAND_NLST:
1162 ftpdata_state->
direction = data->direction;
1164 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1166 case FTP_COMMAND_LIST:
1167 ftpdata_state->
direction = data->direction;
1169 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1171 case FTP_COMMAND_MLSD:
1172 ftpdata_state->
direction = data->direction;
1174 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1185 input_len,
flags) != 0) {
1195 if ((direction & ftpdata_state->
direction) == 0) {
1199 SCLogDebug(
"input %u not for us (%s): %s/%s", input_len,
1200 (direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
1201 ftpdata_state->
command == FTP_COMMAND_STOR ?
"STOR" :
"RETR",
1202 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1205 if (ftpdata_state->
state == FTPDATA_STATE_FINISHED) {
1210 if (ftpdata_state->
file_name && input_len != 0) {
1214 SCLogDebug(
"FileAppendData() - file no longer being extracted");
1216 }
else if (ret < 0) {
1217 SCLogDebug(
"FileAppendData() failed: %d", ret);
1229 ftpdata_state->
state = FTPDATA_STATE_FINISHED;
1230 SCLogDebug(
"closed because of eof: state now FTPDATA_STATE_FINISHED");
1242 return FTPDataParse(
f, ftp_state, pstate, stream_slice, local_data, STREAM_TOSERVER);
1248 return FTPDataParse(
f, ftp_state, pstate, stream_slice, local_data, STREAM_TOCLIENT);
1253 static uint64_t ftpdata_state_memuse = 0;
1254 static uint64_t ftpdata_state_memcnt = 0;
1257 static void *FTPDataStateAlloc(
void *orig_state,
AppProto proto_orig)
1264 state->
state = FTPDATA_STATE_IN_PROGRESS;
1268 ftpdata_state_memcnt++;
1275 static void FTPDataStateFree(
void *s)
1290 ftpdata_state_memcnt--;
1308 static void FTPDataStateTransactionFree(
void *state, uint64_t tx_id)
1313 static void *FTPDataGetTx(
void *state, uint64_t tx_id)
1319 static uint64_t FTPDataGetTxCnt(
void *state)
1325 static int FTPDataGetAlstateProgress(
void *tx, uint8_t direction)
1328 if (direction == ftpdata_state->
direction)
1329 return ftpdata_state->
state;
1331 return FTPDATA_STATE_FINISHED;
1339 if (direction == ftpdata_state->
direction)
1340 files.
fc = ftpdata_state->
files;
1345 static void FTPSetMpmState(
void)
1348 if (
unlikely(ftp_mpm_ctx == NULL)) {
1353 SCFTPSetMpmState(ftp_mpm_ctx);
1357 static void FTPFreeMpmState(
void)
1359 if (ftp_mpm_ctx != NULL) {
1377 if (state->
un.
ptr == NULL) {
1383 while (tx_ptr->
tx_id < min_tx_id) {
1389 if (tx_ptr->
tx_id >= max_tx_id) {
1396 .has_next = (state->
un.
ptr != NULL),
1406 const char *proto_name =
"ftp";
1407 const char *proto_data_name =
"ftp-data";
1412 if (FTPRegisterPatternsForProtocolDetection() < 0 )
1424 IPPROTO_TCP,
ALPROTO_FTP, STREAM_TOSERVER | STREAM_TOCLIENT);
1434 FTPLocalStorageFree);
1440 ALPROTO_FTP, FTP_STATE_FINISHED, FTP_STATE_FINISHED);
1444 FTPDataParseRequest);
1446 FTPDataParseResponse);
1472 sbcfg.
Calloc = FTPCalloc;
1474 sbcfg.
Free = FTPFree;
1478 SCLogInfo(
"Parser disabled for %s protocol. Protocol detection still on.", proto_name);
1507 if (!buffer || *buffer ==
'\0') {
1511 const char *c = strchr(buffer,
'\n');
1512 return c == NULL ?
len : (uint16_t)(c - buffer + 1);
1518 SCJbOpenObject(jb,
"ftp_data");
1521 SCJbSetStringFromBytes(jb,
"filename", ftp_state->
file_name, ftp_state->
file_len);
1524 case FTP_COMMAND_STOR:
1527 case FTP_COMMAND_APPE:
1530 case FTP_COMMAND_STOU:
1533 case FTP_COMMAND_RETR:
1536 case FTP_COMMAND_NLST:
1539 case FTP_COMMAND_LIST:
1542 case FTP_COMMAND_MLSD:
1566 static int FTPParserTest01(
void)
1569 uint8_t ftpbuf[] =
"PORT 192,168,1,1,0,80\r\n";
1570 uint32_t ftplen =
sizeof(ftpbuf) - 1;
1574 memset(&
f, 0,
sizeof(
f));
1575 memset(&
ssn, 0,
sizeof(
ssn));
1584 STREAM_TOSERVER | STREAM_EOF, ftpbuf, ftplen);
1598 static int FTPParserTest11(
void)
1601 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80\r\n";
1602 uint8_t ftpbuf2[] =
"RETR\r\n";
1603 uint8_t ftpbuf3[] =
"227 OK\r\n";
1608 memset(&
f, 0,
sizeof(
f));
1609 memset(&
ssn, 0,
sizeof(
ssn));
1618 STREAM_TOSERVER | STREAM_START, ftpbuf1,
1619 sizeof(ftpbuf1) - 1);
1626 sizeof(ftpbuf3) - 1);
1630 STREAM_TOSERVER, ftpbuf2,
1631 sizeof(ftpbuf2) - 1);
1646 static int FTPParserTest12(
void)
1649 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80\r\n";
1650 uint8_t ftpbuf2[] =
"STOR\r\n";
1651 uint8_t ftpbuf3[] =
"227 OK\r\n";
1656 memset(&
f, 0,
sizeof(
f));
1657 memset(&
ssn, 0,
sizeof(
ssn));
1666 STREAM_TOSERVER | STREAM_START, ftpbuf1,
1667 sizeof(ftpbuf1) - 1);
1674 sizeof(ftpbuf3) - 1);
1678 STREAM_TOSERVER, ftpbuf2,
1679 sizeof(ftpbuf2) - 1);
1695 static int FTPParserTest13(
void)
1698 uint8_t ftpbuf[] =
"USER anonymous \r\n";
1699 const char expected[] =
"USER anonymous";
1704 memset(&
f, 0,
sizeof(
f));
1705 memset(&
ssn, 0,
sizeof(
ssn));
1716 ftpbuf,
sizeof(ftpbuf) - 1);
1742 static int FTPParserTest14(
void)
1745 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80 \r\n";
1746 uint8_t ftpbuf2[] =
"227 OK\r\n";
1747 const char expected[] =
"PORT 192,168,1,1,0,80";
1752 memset(&
f, 0,
sizeof(
f));
1753 memset(&
ssn, 0,
sizeof(
ssn));
1762 ftpbuf1,
sizeof(ftpbuf1) - 1);
1771 FAIL_IF(memcmp(ftp_state->
port_line, expected,
sizeof(expected) - 1) != 0);
1786 static int FTPParserTest15(
void)
1789 uint8_t ftpbuf1[] =
"USER anonymous\r\n";
1790 const uint8_t ppr[] =
"150 \r\n";
1791 const uint8_t
final[] =
"226 done\r\n";
1792 const uint32_t nppr = 100;
1795 uint32_t ftplen2 = nppr * (
sizeof(ppr) - 1) +
sizeof(
final) - 1;
1796 uint8_t *ftpbuf2 =
SCMalloc(ftplen2);
1798 for (uint32_t i = 0; i < nppr; i++) {
1799 memcpy(ftpbuf2 + i * (
sizeof(ppr) - 1), ppr,
sizeof(ppr) - 1);
1801 memcpy(ftpbuf2 + nppr * (
sizeof(ppr) - 1),
final,
sizeof(
final) - 1);
1805 memset(&
f, 0,
sizeof(
f));
1806 memset(&
ssn, 0,
sizeof(
ssn));
1815 ftpbuf1,
sizeof(ftpbuf1) - 1);
1833 FAIL_IF(
cnt != ftp_max_preliminary_responses + 1);
1835 FAIL_IF(!AppLayerDecoderEventsIsEventSet(
1847 static int FTPParserTest16(
void)
1850 uint8_t ftpbuf1[] =
"FEAT\r\n";
1851 const uint8_t first[] =
"211-Features:\r\n";
1852 const uint8_t mid[] =
"211-SIZE\r\n";
1853 const uint8_t last[] =
"211 End\r\n";
1854 const uint32_t nmid = 100;
1857 uint32_t ftplen2 =
sizeof(first) - 1 + nmid * (
sizeof(mid) - 1) +
sizeof(last) - 1;
1858 uint8_t *ftpbuf2 =
SCMalloc(ftplen2);
1860 uint8_t *
p = ftpbuf2;
1861 memcpy(
p, first,
sizeof(first) - 1);
1862 p +=
sizeof(first) - 1;
1863 for (uint32_t i = 0; i < nmid; i++) {
1864 memcpy(
p, mid,
sizeof(mid) - 1);
1865 p +=
sizeof(mid) - 1;
1867 memcpy(
p, last,
sizeof(last) - 1);
1871 memset(&
f, 0,
sizeof(
f));
1872 memset(&
ssn, 0,
sizeof(
ssn));
1881 ftpbuf1,
sizeof(ftpbuf1) - 1);
1899 FAIL_IF(AppLayerDecoderEventsIsEventSet(
1912 static int FTPParserTest17(
void)
1915 uint8_t ftpbuf1[] =
"USER anonymous\r\n";
1916 const uint8_t ppr[] =
"150 \r\n";
1917 const uint32_t nlong = 3;
1922 uint32_t ftplen2 = ftp_max_preliminary_responses * (
sizeof(ppr) - 1) + nlong * (long_len + 2);
1923 uint8_t *ftpbuf2 =
SCMalloc(ftplen2);
1925 uint8_t *
p = ftpbuf2;
1926 for (uint32_t i = 0; i < ftp_max_preliminary_responses; i++) {
1927 memcpy(
p, ppr,
sizeof(ppr) - 1);
1928 p +=
sizeof(ppr) - 1;
1930 for (uint32_t i = 0; i < nlong; i++) {
1931 memcpy(
p,
"150 ", 4);
1932 memset(
p + 4,
'a', long_len - 4);
1934 memcpy(
p,
"\r\n", 2);
1940 memset(&
f, 0,
sizeof(
f));
1941 memset(&
ssn, 0,
sizeof(
ssn));
1950 ftpbuf1,
sizeof(ftpbuf1) - 1);
1962 FAIL_IF(!AppLayerDecoderEventsIsEventSet(
1976 static int FTPParserTest18(
void)
1981 void *ptr = FTPCalloc(1, 1024);
1985 void *smaller = FTPRealloc(ptr, 1024, 512);
1989 FTPFree(smaller, 512);