- Added/removed missing/superfluous util-memrchr.h include
- Improved the extraction of a IP from the XFF chain of IPs
#include "util-optimize.h"
-#include "util-memrchr.h"
-
#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
#endif
#include "app-layer-htp-xff.h"
#include "util-misc.h"
+#include "util-memrchr.h"
/** XFF header value minimal length */
#define XFF_CHAIN_MINLEN 7
/** Get the first IP address from the chain */
p_xff = memchr(xff_chain, ',', bstr_len(h_xff->value));
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;
}