Skip to content

Commit

Permalink
FR_CODE_MAX is 255, so we need 256 entries in arrays...
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Dec 29, 2017
1 parent afbf6dc commit f45e28c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/include/radsniff.h
Expand Up @@ -93,7 +93,7 @@ typedef struct rs_stats_value_tmpl rs_stats_value_tmpl_t;
#endif

typedef struct rs_counters {
uint64_t type[FR_CODE_MAX];
uint64_t type[FR_CODE_MAX + 1];
} rs_counters_t;

/** Stats for a single interval
Expand Down Expand Up @@ -153,7 +153,7 @@ typedef struct rs_malformed {
typedef struct rs_stats {
int intervals; //!< Number of stats intervals.

rs_latency_t exchange[FR_CODE_MAX]; //!< We end up allocating ~16K, but memory is cheap so
rs_latency_t exchange[FR_CODE_MAX + 1]; //!< We end up allocating ~16K, but memory is cheap so
//!< what the hell. This is required because instances of
//!< FreeRADIUS delay Access-Rejects, which would artificially
//!< increase latency stats for Access-Requests.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/proto_detail/proto_detail.c
Expand Up @@ -109,7 +109,7 @@ static int type_parse(TALLOC_CTX *ctx, void *out, CONF_ITEM *ci, UNUSED CONF_PAR
}

code = type_enum->value->vb_uint32;
if (!code || (code >= FR_CODE_MAX)) {
if (!code || (code > FR_CODE_MAX)) {
cf_log_err(ci, "Invalid value for 'type = %s'", type_str);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/proto_radius/proto_radius.c
Expand Up @@ -292,7 +292,7 @@ static void mod_process_set(void const *instance, REQUEST *request)
fr_io_process_t process;

rad_assert(request->packet->code != 0);
rad_assert(request->packet->code < FR_CODE_MAX);
rad_assert(request->packet->code <= FR_CODE_MAX);

request->server_cs = inst->server_cs;

Expand Down
4 changes: 2 additions & 2 deletions src/modules/proto_radius/proto_radius.h
Expand Up @@ -72,15 +72,15 @@ typedef struct {

dl_instance_t **type_submodule; //!< Instance of the various types
//!< only one instance per type allowed.
fr_io_process_t process_by_code[FR_CODE_MAX]; //!< Lookup process entry point by code.
fr_io_process_t process_by_code[FR_CODE_MAX + 1]; //!< Lookup process entry point by code.

uint32_t max_packet_size; //!< for message ring buffer.
uint32_t num_messages; //!< for message ring buffer.
uint32_t max_attributes; //!< Limit maximum decodable attributes.

bool tunnel_password_zeros;

bool code_allowed[FR_CODE_MAX]; //!< Lookup allowed packet codes.
bool code_allowed[FR_CODE_MAX + 1]; //!< Lookup allowed packet codes.

fr_listen_t const *listen; //!< The listener structure which describes
///< the I/O path.
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/radius/base.c
Expand Up @@ -155,7 +155,7 @@ char const *fr_packet_codes[FR_MAX_PACKET_CODE] = {
"Protocol-Error",
};

bool const fr_request_packets[FR_CODE_MAX] = {
bool const fr_request_packets[FR_CODE_MAX + 1] = {
[FR_CODE_ACCESS_REQUEST] = true,
[FR_CODE_ACCOUNTING_REQUEST] = true,
[FR_CODE_STATUS_SERVER] = true,
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/radius/radius.h
Expand Up @@ -54,7 +54,7 @@ extern char const *fr_packet_codes[FR_MAX_PACKET_CODE];
#define FR_TUNNEL_FR_ENC_LENGTH(_x) (2 + 1 + _x + PAD(_x + 1, 16))
extern size_t const fr_radius_attr_sizes[FR_TYPE_MAX + 1][2];
extern FR_NAME_NUMBER const fr_request_types[];
extern bool const fr_request_packets[FR_CODE_MAX];
extern bool const fr_request_packets[FR_CODE_MAX + 1];

typedef enum {
DECODE_FAIL_NONE = 0,
Expand Down

0 comments on commit f45e28c

Please sign in to comment.