From c089bbb7d7a6250fc4fdcffca1923a29916c1e1e Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Wed, 8 Mar 2023 21:16:03 +0530 Subject: [PATCH] util/mime: use uint32_t for consumed bytes 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util-decode-mime.c b/src/util-decode-mime.c index b10b737855..19516b66bd 100644 --- a/src/util-decode-mime.c +++ b/src/util-decode-mime.c @@ -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];