Skip to content

Commit be2d80a

Browse files
catenacybervictorjulien
authored andcommitted
ftp-data: check direction before finished state
Ticket: 6813 So, in the case we have a ftp-data flow with data to client as expected, but after to_client side completes (with timeout for example), the client sends some data to server, In this case, we want to check first the direction, and bail out, then do the assertion check about the finished state.
1 parent 28a3337 commit be2d80a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/app-layer-ftp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,6 @@ static AppLayerResult FTPDataParse(Flow *f, FtpDataState *ftpdata_state,
10751075
SCFlowFreeStorageById(f, AppLayerExpectationGetFlowId());
10761076
ftpdata_state->tx_data.files_opened = 1;
10771077
} else {
1078-
if (ftpdata_state->state == FTPDATA_STATE_FINISHED) {
1079-
SCLogDebug("state is already finished");
1080-
DEBUG_VALIDATE_BUG_ON(input_len); // data after state finished is a bug.
1081-
SCReturnStruct(APP_LAYER_OK);
1082-
}
10831078
if ((direction & ftpdata_state->direction) == 0) {
10841079
if (input_len) {
10851080
// TODO set event for data in wrong direction
@@ -1090,6 +1085,11 @@ static AppLayerResult FTPDataParse(Flow *f, FtpDataState *ftpdata_state,
10901085
(ftpdata_state->direction & STREAM_TOSERVER) ? "toserver" : "toclient");
10911086
SCReturnStruct(APP_LAYER_OK);
10921087
}
1088+
if (ftpdata_state->state == FTPDATA_STATE_FINISHED) {
1089+
SCLogDebug("state is already finished");
1090+
DEBUG_VALIDATE_BUG_ON(input_len); // data after state finished is a bug.
1091+
SCReturnStruct(APP_LAYER_OK);
1092+
}
10931093
if (input_len != 0) {
10941094
ret = FileAppendData(ftpdata_state->files, &sbcfg, input, input_len);
10951095
if (ret == -2) {

0 commit comments

Comments
 (0)