]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smtp: improve ProcessDataChunk error checking
authorVictor Julien <victor@inliniac.net>
Tue, 28 Oct 2014 17:25:33 +0000 (18:25 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Oct 2014 12:33:54 +0000 (13:33 +0100)
src/app-layer-smtp.c

index c08ce7231579e2b47d6289268f2ce1ce06f515ce..e58eccb0d44ef80b89ff4d78887156c090e619b1 100644 (file)
@@ -366,6 +366,7 @@ static int ProcessDataChunk(const uint8_t *chunk, uint32_t len,
                     ret = FileCloseFile(files, (uint8_t *) NULL, 0, flags);
                     if (ret != 0) {
                         SCLogDebug("FileCloseFile() failed: %d", ret);
+                        ret = MIME_DEC_ERR_DATA;
                     }
                 } else {
                     SCLogDebug("File already closed");
@@ -379,6 +380,7 @@ static int ProcessDataChunk(const uint8_t *chunk, uint32_t len,
                 ret = FileCloseFile(files, (uint8_t *) chunk, len, flags);
                 if (ret != 0) {
                     SCLogDebug("FileCloseFile() failed: %d", ret);
+                    ret = MIME_DEC_ERR_DATA;
                 }
             } else {
                 SCLogDebug("File already closed");
@@ -394,10 +396,11 @@ static int ProcessDataChunk(const uint8_t *chunk, uint32_t len,
                 SCLogDebug("FileAppendData() - file no longer being extracted");
             } else if (ret < 0) {
                 SCLogDebug("FileAppendData() failed: %d", ret);
+                ret = MIME_DEC_ERR_DATA;
             }
         }
 
-        if (ret == MIME_DEC_OK) {
+        if (ret == 0) {
             SCLogDebug("Successfully processed file data!");
         }
     } else {