aboutsummaryrefslogtreecommitdiff
path: root/sf-pcapng.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-07-01 02:15:40 -0700
committerGuy Harris <gharris@sonic.net>2020-07-01 02:15:40 -0700
commit5a68762e8b0cae345e4f42ff2dc4eee9ce32329d (patch)
tree86aa6ef65f73ee37f2ac80031ae2f81bb2d3c457 /sf-pcapng.c
parent89b721fb41bf47b21662752221a4dd13a464da99 (diff)
Handle the pcap_t+private data in a fashion that makes fewer assumptions.
The sizeof operator and alignof macro can be given a type "name" that's anonymous, e.g. sizeof(struct { int a; char *b; }). Have pcap_create_common() and pcap_open_offline_common() take, as arguments, the total size of a structure containing both the pcap_t and the private data as members, and the offset of the private data in that structure, and define macros that calculate those given, as an argument, the data type of the private data. This avoids making assumptions about the alignment of those two items within the structure; that *might* fix GitHub issue #940 if the issue is that the ARM compiler being used does 16-byte alignment of the private structure, rather than the 8-byte alignment we were wiring in.
Diffstat (limited to 'sf-pcapng.c')
-rw-r--r--sf-pcapng.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sf-pcapng.c b/sf-pcapng.c
index 24eb5f73..f7f413d3 100644
--- a/sf-pcapng.c
+++ b/sf-pcapng.c
@@ -876,7 +876,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
* OK, this is a good pcapng file.
* Allocate a pcap_t for it.
*/
- p = pcap_open_offline_common(errbuf, sizeof (struct pcap_ng_sf));
+ p = PCAP_OPEN_OFFLINE_COMMON(errbuf, struct pcap_ng_sf);
if (p == NULL) {
/* Allocation failed. */
*err = 1;