mime: remove unused 'linerem' logic

pull/7586/head
Victor Julien 4 years ago
parent 5953a7d2eb
commit 0871029d17

@ -1152,38 +1152,31 @@ static int ProcessDecodedDataChunk(const uint8_t *chunk, uint32_t len,
(entity->ctnt_flags & CTNT_IS_HTML)) && (entity->ctnt_flags & CTNT_IS_HTML)) &&
((entity->ctnt_flags & CTNT_IS_ATTACHMENT) == 0)) { ((entity->ctnt_flags & CTNT_IS_ATTACHMENT) == 0)) {
/* Remainder from previous line */ /* Parse each line one by one */
if (state->linerem_len > 0) { remainPtr = (uint8_t *)chunk;
// TODO do {
} else { tok = GetLine(
/* No remainder from previous line */ remainPtr, len - (remainPtr - (uint8_t *)chunk), &remainPtr, &tokLen);
/* Parse each line one by one */ if (tok != remainPtr) {
remainPtr = (uint8_t *)chunk; /* If last token found without CR/LF delimiter, then save
do { * and reconstruct with next chunk
tok = GetLine(remainPtr, len - (remainPtr - (uint8_t *)chunk), */
&remainPtr, &tokLen); if (tok + tokLen - (uint8_t *)chunk == (int)len) {
if (tok != remainPtr) { PrintChars(SC_LOG_DEBUG, "LAST CHUNK LINE - CUTOFF", tok, tokLen);
// DEBUG - ADDED SCLogDebug("\nCHUNK CUTOFF CHARS: %u delim %u\n", tokLen,
/* If last token found without CR/LF delimiter, then save len - (uint32_t)(tok + tokLen - (uint8_t *)chunk));
* and reconstruct with next chunk } else {
*/ /* Search line for URL */
if (tok + tokLen - (uint8_t *) chunk == (int)len) { ret = FindUrlStrings(tok, tokLen, state);
PrintChars(SC_LOG_DEBUG, "LAST CHUNK LINE - CUTOFF", if (ret != MIME_DEC_OK) {
tok, tokLen); SCLogDebug("Error: FindUrlStrings() function"
SCLogDebug("\nCHUNK CUTOFF CHARS: %u delim %u\n", " failed: %d",
tokLen, len - (uint32_t)(tok + tokLen - (uint8_t *) chunk)); ret);
} else { break;
/* Search line for URL */
ret = FindUrlStrings(tok, tokLen, state);
if (ret != MIME_DEC_OK) {
SCLogDebug("Error: FindUrlStrings() function"
" failed: %d", ret);
break;
}
} }
} }
} while (tok != remainPtr && remainPtr - (uint8_t *) chunk < (int)len); }
} } while (tok != remainPtr && remainPtr - (uint8_t *)chunk < (int)len);
} }
} }

@ -65,7 +65,6 @@
/* Publicly exposed size constants */ /* Publicly exposed size constants */
#define DATA_CHUNK_SIZE 3072 /* Should be divisible by 3 */ #define DATA_CHUNK_SIZE 3072 /* Should be divisible by 3 */
#define LINEREM_SIZE 256
/* Mime Parser Constants */ /* Mime Parser Constants */
#define HEADER_READY 0x01 #define HEADER_READY 0x01
@ -197,8 +196,6 @@ typedef struct MimeDecParseState {
uint32_t hlen; /**< Length of the last known header name */ uint32_t hlen; /**< Length of the last known header name */
uint32_t hvlen; /**< Total length of value list */ uint32_t hvlen; /**< Total length of value list */
DataValue *hvalue; /**< Pointer to the incomplete header value list */ DataValue *hvalue; /**< Pointer to the incomplete header value list */
uint8_t linerem[LINEREM_SIZE]; /**< Remainder from previous line (for URL extraction) */
uint16_t linerem_len; /**< Length of remainder from previous line */
uint8_t bvremain[B64_BLOCK]; /**< Remainder from base64-decoded line */ uint8_t bvremain[B64_BLOCK]; /**< Remainder from base64-decoded line */
uint8_t bvr_len; /**< Length of remainder from base64-decoded line */ uint8_t bvr_len; /**< Length of remainder from base64-decoded line */
uint8_t data_chunk[DATA_CHUNK_SIZE]; /**< Buffer holding data chunk */ uint8_t data_chunk[DATA_CHUNK_SIZE]; /**< Buffer holding data chunk */

Loading…
Cancel
Save