From: Shivani Bhardwaj Date: Wed, 8 Mar 2023 15:46:03 +0000 (+0530) Subject: util/mime: use uint32_t for consumed bytes X-Git-Tag: suricata-7.0.0-rc2~533 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8581%2Fhead;p=thirdparty%2Fsuricata.git 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 --- 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];