]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/mime: use uint32_t for consumed bytes 8581/head
authorShivani Bhardwaj <shivani@oisf.net>
Wed, 8 Mar 2023 15:46:03 +0000 (21:16 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 9 Mar 2023 10:13:54 +0000 (15:43 +0530)
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

src/util-decode-mime.c

index b10b7378559c187edc551aa506701ada9f961437..19516b66bdb761739f01fdb5442e23531eb9b12c 100644 (file)
@@ -1176,10 +1176,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' */
     uint8_t cnt = 0;
     uint8_t block[B64_BLOCK];