]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/mime: use uint32_t for consumed bytes
authorShivani Bhardwaj <shivani@oisf.net>
Wed, 8 Mar 2023 15:46:03 +0000 (21:16 +0530)
committerVictor Julien <vjulien@oisf.net>
Tue, 28 Mar 2023 09:35:36 +0000 (11:35 +0200)
In a case of the line buffer being over 255 bytes, the consumed bytes
would reset to 0 as it was uint8_t. Fix this integer overflow by setting
the type to uint32_t.

Redmine ticket: 5883

(cherry picked from commit c089bbb7d7a6250fc4fdcffca1923a29916c1e1e)

src/util-decode-mime.c

index 59d0872993d04dd9cdf774588e1b8a43f42c1570..8e3b4b0e46c37c4621db7c5a80c7c0b61c3d5e66 100644 (file)
@@ -1199,10 +1199,10 @@ static int ProcessDecodedDataChunk(const uint8_t *chunk, uint32_t len,
  *
  * \return Number of bytes consumed from `buf`
  */
-static uint8_t ProcessBase64Remainder(
+static uint32_t ProcessBase64Remainder(
         const uint8_t *buf, const uint32_t len, MimeDecParseState *state, int force)
 {
-    uint8_t buf_consumed = 0; /* consumed bytes from 'buf' */
+    uint32_t buf_consumed = 0; /* consumed bytes from 'buf' */
     uint32_t cnt = 0;
     uint8_t block[B64_BLOCK];