Fix and improvements

- Added/removed missing/superfluous util-memrchr.h include
- Improved the extraction of a IP from the XFF chain of IPs
pull/1265/merge
Duarte Silva 12 years ago committed by Victor Julien
parent 68f43ffffb
commit e586644c25

@ -69,8 +69,6 @@
#include "util-optimize.h" #include "util-optimize.h"
#include "util-memrchr.h"
#ifndef IPPROTO_SCTP #ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132 #define IPPROTO_SCTP 132
#endif #endif

@ -30,6 +30,7 @@
#include "app-layer-htp-xff.h" #include "app-layer-htp-xff.h"
#include "util-misc.h" #include "util-misc.h"
#include "util-memrchr.h"
/** XFF header value minimal length */ /** XFF header value minimal length */
#define XFF_CHAIN_MINLEN 7 #define XFF_CHAIN_MINLEN 7
@ -94,7 +95,7 @@ int HttpXFFGetIPFromTx(const Packet *p, uint64_t tx_id, HttpXFFCfg *xff_cfg,
/** Get the first IP address from the chain */ /** Get the first IP address from the chain */
p_xff = memchr(xff_chain, ',', bstr_len(h_xff->value)); p_xff = memchr(xff_chain, ',', bstr_len(h_xff->value));
if (p_xff != NULL) { if (p_xff != NULL) {
xff_chain[bstr_len(h_xff->value) - strlen((char *)p_xff)]=0; xff_chain[bstr_len(h_xff->value) - (p_xff - xff_chain)]=0;
} }
p_xff = xff_chain; p_xff = xff_chain;
} }

Loading…
Cancel
Save