Skip to content

Commit c1392d9

Browse files
committed
http/xff: harden code against http in detection-only
1 parent c01aa71 commit c1392d9

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/app-layer-htp-xff.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,14 @@ int HttpXFFGetIPFromTx(
182182
*/
183183
int HttpXFFGetIP(const Flow *f, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen)
184184
{
185-
HtpState *htp_state = NULL;
186-
uint64_t tx_id = AppLayerParserGetMinId(f->alparser);
187-
uint64_t total_txs = 0;
188-
189-
htp_state = (HtpState *)FlowGetAppState(f);
185+
HtpState *htp_state = (HtpState *)FlowGetAppState(f);
190186
if (htp_state == NULL) {
191187
SCLogDebug("no http state, XFF IP cannot be retrieved");
192188
goto end;
193189
}
194190

195-
total_txs = AppLayerParserGetTxCnt(f, htp_state);
191+
uint64_t tx_id = AppLayerParserGetMinId(f->alparser);
192+
const uint64_t total_txs = AppLayerParserGetTxCnt(f, htp_state);
196193
AppLayerGetTxIteratorFunc IterFunc = AppLayerGetTxIterator(f->proto, f->alproto);
197194
AppLayerGetTxIterState state;
198195
memset(&state, 0, sizeof(state));

0 commit comments

Comments
 (0)