Skip to content

Commit

Permalink
Use C99 way of declaring a variable length field
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Feb 4, 2015
1 parent 97b7241 commit 2f1c79b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/include/net.h
Expand Up @@ -132,7 +132,7 @@ typedef struct radius_packet_t {
uint8_t id;
uint8_t length[2];
uint8_t vector[AUTH_VECTOR_LEN];
uint8_t data[1];
uint8_t data[];
} radius_packet_t;

ssize_t fr_link_layer_offset(uint8_t const *data, size_t len, int link_type);
Expand Down
2 changes: 1 addition & 1 deletion src/main/radsniff.c
Expand Up @@ -1060,7 +1060,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
/*
* End of variable length bits, do basic check now to see if packet looks long enough
*/
len = (p - data) + sizeof(udp_header_t) + (sizeof(radius_packet_t) - 1); /* length value */
len = (p - data) + sizeof(udp_header_t) + sizeof(radius_packet_t); /* length value */
if ((size_t) len > header->caplen) {
REDEBUG("Packet too small, we require at least %zu bytes, captured %i bytes",
(size_t) len, header->caplen);
Expand Down

0 comments on commit 2f1c79b

Please sign in to comment.