]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: move app_progress forward on errors as well
authorVictor Julien <vjulien@oisf.net>
Tue, 21 Dec 2021 08:59:15 +0000 (09:59 +0100)
committerVictor Julien <vjulien@oisf.net>
Mon, 17 Jan 2022 20:44:04 +0000 (21:44 +0100)
In case of APP_LAYER_ERROR still move the app_progress forward.
This helps validation of frame offsets and should be harmless
otherwise.

src/app-layer.c

index dbe390e2df01511d7e8572738bfd94bfb239663e..073a693fb2300020feaed70e71913eedc463a3f6 100644 (file)
@@ -460,10 +460,11 @@ static int TCPProtoDetect(ThreadVars *tv,
         int r = AppLayerParserParse(tv, app_tctx->alp_tctx, f, f->alproto,
                 flags, data, data_len);
         PACKET_PROFILING_APP_END(app_tctx, f->alproto);
+        if (r != 1) {
+            StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
+        }
         if (r < 0) {
             SCReturnInt(-1);
-        } else if (r == 0) {
-            StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
         }
     } else {
         /* if the ssn is midstream, we may end up with a case where the
@@ -533,7 +534,7 @@ static int TCPProtoDetect(ThreadVars *tv,
                             f->alproto, flags,
                             data, data_len);
                     PACKET_PROFILING_APP_END(app_tctx, f->alproto);
-                    if (r == 0) {
+                    if (r != 1) {
                         StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
                     }
 
@@ -710,7 +711,7 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
             r = AppLayerParserParse(tv, app_tctx->alp_tctx, f, f->alproto,
                                     flags, data, data_len);
             PACKET_PROFILING_APP_END(app_tctx, f->alproto);
-            if (r == 0) {
+            if (r != 1) {
                 StreamTcpUpdateAppLayerProgress(ssn, direction, data_len);
             }
         }