Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next/675/20241219/v1 #437

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions htp/htp.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ struct htp_tx_t {
*/
int is_config_shared;

SCAN_BUILD_X64_PADDING(int pad0;)

/** The user data associated with this transaction. */
void *user_data;

Expand All @@ -230,6 +232,8 @@ struct htp_tx_t {
/** Contains a count of how many empty lines were skipped before the request line. */
unsigned int request_ignored_lines;

SCAN_BUILD_X64_PADDING(int pad1;)

/** The first line of this request. */
bstr *request_line;

Expand All @@ -239,6 +243,8 @@ struct htp_tx_t {
/** Request method, as number. Available only if we were able to recognize the request method. */
enum htp_method_t request_method_number;

SCAN_BUILD_X64_PADDING(int pad2;)

/**
* Request URI, raw, as given to us on the request line. This field can take different forms,
* for example authority for CONNECT methods, absolute URIs for proxy requests, and the query
Expand Down Expand Up @@ -421,6 +427,8 @@ struct htp_tx_t {
*/
int response_protocol_number;

SCAN_BUILD_X64_PADDING(int pad3;)

/**
* Response status code, as text. Starts as NULL and can remain NULL on
* an invalid response that does not specify status code.
Expand All @@ -445,6 +453,8 @@ struct htp_tx_t {
/** Have we seen the server respond with a 100 response? */
int seen_100continue;

SCAN_BUILD_X64_PADDING(int pad4;)

/** Parsed response headers. Contains instances of htp_header_t. */
htp_table_t *response_headers;

Expand Down Expand Up @@ -512,6 +522,8 @@ struct htp_tx_t {
*/
enum htp_content_encoding_t response_content_encoding_processing;

SCAN_BUILD_X64_PADDING(int pad5;)

/**
* This field will contain the response content type when that information
* is available in response headers. The contents of the field will be converted
Expand Down
51 changes: 51 additions & 0 deletions htp/htp_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,57 @@
extern "C" {
#endif

/* Define SCAN_BUILD_X64_PADDING to add padding to structs for
* when clang scan-build is used with the optin.performance.Padding
* checker. */
#if defined(__clang_analyzer__)
/** FreeBSD does not define __WORDSIZE, but it uses __LONG_BIT */
#ifndef __WORDSIZE
#ifdef __LONG_BIT
#define __WORDSIZE __LONG_BIT
#else
#ifdef LONG_BIT
#define __WORDSIZE LONG_BIT
#endif
#endif
#endif

/** Windows does not define __WORDSIZE, but it uses __X86__ */
#ifndef __WORDSIZE
#if defined(__X86__) || defined(_X86_) || defined(_M_IX86)
#define __WORDSIZE 32
#else
#if defined(__X86_64__) || defined(_X86_64_) || \
defined(__x86_64) || defined(__x86_64__) || \
defined(__amd64) || defined(__amd64__)
#define __WORDSIZE 64
#endif
#endif
#endif

/** if not succesful yet try the data models */
#ifndef __WORDSIZE
#if defined(_ILP32) || defined(__ILP32__)
#define __WORDSIZE 32
#endif
#if defined(_LP64) || defined(__LP64__)
#define __WORDSIZE 64
#endif
#endif

#ifndef __WORDSIZE
#define __WORDSIZE 64
#endif

#if __WORDSIZE==64
#define SCAN_BUILD_X64_PADDING(x) x
#else
#define SCAN_BUILD_X64_PADDING(_x)
#endif
#else /* else __clang_analyzer__ */
#define SCAN_BUILD_X64_PADDING(_x)
#endif /* end __clang_analyzer__ */

typedef int htp_status_t;

typedef struct htp_cfg_t htp_cfg_t;
Expand Down
Loading