app-layer: remove obsolete NULL check

Completes commit 833a738dd1

Fixes coverity 1646610
pull/13079/head
Philippe Antoine 2 years ago committed by Victor Julien
parent be483dc873
commit f301cd3702

@ -953,13 +953,11 @@ void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
(pkt_dir == STREAM_TOSERVER) ? ts_disrupt_flags : tc_disrupt_flags); (pkt_dir == STREAM_TOSERVER) ? ts_disrupt_flags : tc_disrupt_flags);
AppLayerParserFileTxHousekeeping(f, tx, pkt_dir, (bool)pkt_dir_trunc); AppLayerParserFileTxHousekeeping(f, tx, pkt_dir, (bool)pkt_dir_trunc);
} }
if (txd) { // should be reset by parser next time it updates the tx
// should be reset by parser next time it updates the tx if (pkt_dir & STREAM_TOSERVER) {
if (pkt_dir & STREAM_TOSERVER) { txd->updated_ts = false;
txd->updated_ts = false; } else {
} else { txd->updated_tc = false;
txd->updated_tc = false;
}
} }
const int tx_progress_tc = const int tx_progress_tc =
AppLayerParserGetStateProgress(ipproto, alproto, tx, tc_disrupt_flags); AppLayerParserGetStateProgress(ipproto, alproto, tx, tc_disrupt_flags);
@ -976,7 +974,7 @@ void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
goto next; goto next;
} }
if (txd && has_tx_detect_flags) { if (has_tx_detect_flags) {
if (!IS_DISRUPTED(ts_disrupt_flags) && if (!IS_DISRUPTED(ts_disrupt_flags) &&
(f->sgh_toserver != NULL || (f->flags & FLOW_SGH_TOSERVER) == 0)) { (f->sgh_toserver != NULL || (f->flags & FLOW_SGH_TOSERVER) == 0)) {
if ((txd->flags & (APP_LAYER_TX_INSPECTED_TS | APP_LAYER_TX_SKIP_INSPECT_TS)) == if ((txd->flags & (APP_LAYER_TX_INSPECTED_TS | APP_LAYER_TX_SKIP_INSPECT_TS)) ==
@ -1003,7 +1001,7 @@ void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
goto next; goto next;
} }
if (txd && logger_expectation != 0) { if (logger_expectation != 0) {
LoggerId tx_logged = GetTxLogged(txd); LoggerId tx_logged = GetTxLogged(txd);
if (tx_logged != logger_expectation) { if (tx_logged != logger_expectation) {
SCLogDebug("%p/%"PRIu64" skipping: logging not done: want:%"PRIx32", have:%"PRIx32, SCLogDebug("%p/%"PRIu64" skipping: logging not done: want:%"PRIx32", have:%"PRIx32,
@ -1015,19 +1013,17 @@ void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
/* if file logging is enabled, we keep a tx active while some of the files aren't /* if file logging is enabled, we keep a tx active while some of the files aren't
* logged yet. */ * logged yet. */
if (txd) { SCLogDebug("files_opened %u files_logged %u files_stored %u", txd->files_opened,
SCLogDebug("files_opened %u files_logged %u files_stored %u", txd->files_opened, txd->files_logged, txd->files_stored);
txd->files_logged, txd->files_stored);
if (txd->files_opened) {
if (txd->files_opened) { if (g_file_logger_enabled && txd->files_opened != txd->files_logged) {
if (g_file_logger_enabled && txd->files_opened != txd->files_logged) { skipped = true;
skipped = true; goto next;
goto next; }
} if (g_filedata_logger_enabled && txd->files_opened != txd->files_stored) {
if (g_filedata_logger_enabled && txd->files_opened != txd->files_stored) { skipped = true;
skipped = true; goto next;
goto next;
}
} }
} }

@ -275,10 +275,7 @@ void DetectEngineStateResetTxs(Flow *f)
void *inspect_tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, inspect_tx_id); void *inspect_tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, inspect_tx_id);
if (inspect_tx != NULL) { if (inspect_tx != NULL) {
AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, inspect_tx); AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, inspect_tx);
BUG_ON(txd == NULL); ResetTxState(txd->de_state);
if (txd) {
ResetTxState(txd->de_state);
}
} }
} }
} }

@ -175,9 +175,6 @@ static int DetectXbitPostMatchTx(
if (txv == NULL) if (txv == NULL)
return 0; return 0;
AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, txv); AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, txv);
if (txd == NULL) {
return 0;
}
if (xd->cmd != DETECT_XBITS_CMD_SET) if (xd->cmd != DETECT_XBITS_CMD_SET)
return 0; return 0;

@ -1404,12 +1404,10 @@ static inline void StoreDetectProgress(
DetectTransaction *tx, const uint8_t flow_flags, const uint8_t progress) DetectTransaction *tx, const uint8_t flow_flags, const uint8_t progress)
{ {
AppLayerTxData *txd = (AppLayerTxData *)tx->tx_data_ptr; AppLayerTxData *txd = (AppLayerTxData *)tx->tx_data_ptr;
if (likely(txd != NULL)) { if (flow_flags & STREAM_TOSERVER) {
if (flow_flags & STREAM_TOSERVER) { txd->detect_progress_ts = progress;
txd->detect_progress_ts = progress; } else {
} else { txd->detect_progress_tc = progress;
txd->detect_progress_tc = progress;
}
} }
} }

Loading…
Cancel
Save