about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--examples/parse_eapol/parse_eapol.c3
-rw-r--r--src/libwifi/gen/management/action.c8
-rw-r--r--utils/src/test_parsing.c3
3 files changed, 7 insertions, 7 deletions
diff --git a/examples/parse_eapol/parse_eapol.c b/examples/parse_eapol/parse_eapol.c index e8f2827..fb42437 100644 --- a/examples/parse_eapol/parse_eapol.c +++ b/examples/parse_eapol/parse_eapol.c
@@ -5,6 +5,7 @@
5#include <stdio.h> 5#include <stdio.h>
6#include <stdlib.h> 6#include <stdlib.h>
7#include <string.h> 7#include <string.h>
8#include <inttypes.h>
8 9
9static int has_radiotap = 0; 10static int has_radiotap = 0;
10 11
@@ -38,7 +39,7 @@ void handle_pkt(unsigned char *args, const struct pcap_pkthdr *header, const uns
38 printf("EAPOL: Descriptor: %d\n", data.descriptor); 39 printf("EAPOL: Descriptor: %d\n", data.descriptor);
39 printf("EAPOL: Key Info: Information: 0x%04x\n", data.key_info.information); 40 printf("EAPOL: Key Info: Information: 0x%04x\n", data.key_info.information);
40 printf("EAPOL: Key Info: Key Length: %d\n", data.key_info.key_length); 41 printf("EAPOL: Key Info: Key Length: %d\n", data.key_info.key_length);
41 printf("EAPOL: Key Info: Replay Counter: %llu\n", data.key_info.replay_counter); 42 printf("EAPOL: Key Info: Replay Counter: %" PRIu64 "\n", data.key_info.replay_counter);
42 printf("EAPOL: Key Info: Nonce: "); 43 printf("EAPOL: Key Info: Nonce: ");
43 for (size_t i = 0; i < sizeof(data.key_info.nonce); ++i) { 44 for (size_t i = 0; i < sizeof(data.key_info.nonce); ++i) {
44 printf("%02x ", data.key_info.nonce[i]); 45 printf("%02x ", data.key_info.nonce[i]);
diff --git a/src/libwifi/gen/management/action.c b/src/libwifi/gen/management/action.c index dc37987..644f07a 100644 --- a/src/libwifi/gen/management/action.c +++ b/src/libwifi/gen/management/action.c
@@ -22,7 +22,7 @@
22size_t libwifi_add_action_detail(struct libwifi_action_detail *detail, const unsigned char *data, 22size_t libwifi_add_action_detail(struct libwifi_action_detail *detail, const unsigned char *data,
23 size_t data_len) { 23 size_t data_len) {
24 if (detail->detail_length != 0) { 24 if (detail->detail_length != 0) {
25 detail->detail = realloc(detail->detail, data_len); 25 detail->detail = realloc(detail->detail, data_len + detail->detail_length);
26 } else { 26 } else {
27 detail->detail = malloc(data_len); 27 detail->detail = malloc(data_len);
28 } 28 }
@@ -31,10 +31,8 @@ size_t libwifi_add_action_detail(struct libwifi_action_detail *detail, const uns
31 return -EINVAL; 31 return -EINVAL;
32 } 32 }
33 33
34 detail->detail_length = data_len; 34 memcpy(detail->detail + detail->detail_length, data, data_len);
35 35 detail->detail_length += data_len;
36 memcpy(detail->detail, data, data_len);
37 detail->detail_length = data_len;
38 36
39 return detail->detail_length; 37 return detail->detail_length;
40} 38}
diff --git a/utils/src/test_parsing.c b/utils/src/test_parsing.c index b5e2d53..f21894c 100644 --- a/utils/src/test_parsing.c +++ b/utils/src/test_parsing.c
@@ -9,6 +9,7 @@
9#include <stdlib.h> 9#include <stdlib.h>
10#include <string.h> 10#include <string.h>
11#include <sys/types.h> 11#include <sys/types.h>
12#include <inttypes.h>
12 13
13#define PCAP_SAVEFILE "/tmp/debug.pcap" 14#define PCAP_SAVEFILE "/tmp/debug.pcap"
14#define FILTER "" 15#define FILTER ""
@@ -344,7 +345,7 @@ void parse_data_eapol(struct libwifi_frame frame, unsigned char *args, const str
344 printf("EAPOL: Descriptor: %d\n", data.descriptor); 345 printf("EAPOL: Descriptor: %d\n", data.descriptor);
345 printf("EAPOL: Key Info: Information: 0x%04x\n", data.key_info.information); 346 printf("EAPOL: Key Info: Information: 0x%04x\n", data.key_info.information);
346 printf("EAPOL: Key Info: Key Length: %d\n", data.key_info.key_length); 347 printf("EAPOL: Key Info: Key Length: %d\n", data.key_info.key_length);
347 printf("EAPOL: Key Info: Replay Counter: %llu\n", data.key_info.replay_counter); 348 printf("EAPOL: Key Info: Replay Counter: %" PRIu64 "\n", data.key_info.replay_counter);
348 printf("EAPOL: Key Info: Nonce: "); 349 printf("EAPOL: Key Info: Nonce: ");
349 for (size_t i = 0; i < sizeof(data.key_info.nonce); ++i) printf("%02x ", data.key_info.nonce[i]); 350 for (size_t i = 0; i < sizeof(data.key_info.nonce); ++i) printf("%02x ", data.key_info.nonce[i]);
350 printf("\n"); 351 printf("\n");