diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-09-17 15:21:03 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-09-17 22:21:45 +0000 |
commit | 53ac86f8afee62ffb71ede8e1458df6e5be75c7b (patch) | |
tree | 6fa2370c0d2a44291422476438494907333cc417 /wiretap/pcapng.c | |
parent | fe22f471c8e62406c9b4429325dffa2c1f137a21 (diff) |
Make the maximum block size big enough for max-size D-Bus packets.
Change-Id: I352db07084294629160f16f6cf1e07f902a2844f
Reviewed-on: https://code.wireshark.org/review/29711
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/pcapng.c')
-rw-r--r-- | wiretap/pcapng.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index cfe28b91d6..89c623d537 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -51,18 +51,6 @@ pcapng_close(wtap *wth); #define MIN_BLOCK_SIZE ((guint32)(sizeof(pcapng_block_header_t) + sizeof(guint32))) /* - * In order to keep from trying to allocate large chunks of memory, - * which could either fail or, even if it succeeds, chew up so much - * address space or memory+backing store as not to leave room for - * anything else, we impose an upper limit on the size of blocks - * we're willing to handle. - * - * For now, we pick an arbitrary limit of 16MB (OK, fine, 16MiB, but - * don't try saying that on Wikipedia :-) :-) :-)). - */ -#define MAX_BLOCK_SIZE (16*1024*1024) - -/* * Minimum SHB size = minimum block size + size of fixed length portion of SHB. */ #define MIN_SHB_SIZE ((guint32)(MIN_BLOCK_SIZE + sizeof(pcapng_section_header_block_t))) @@ -163,6 +151,21 @@ struct option { /* MSBit of option code means "local type" */ #define OPT_LOCAL_FLAG 0x8000 +/* + * In order to keep from trying to allocate large chunks of memory, + * which could either fail or, even if it succeeds, chew up so much + * address space or memory+backing store as not to leave room for + * anything else, we impose upper limits on the size of blocks we're + * willing to handle. + * + * We pick a limit of an EPB with a maximum-sized D-Bus packet and 128 KiB + * worth of options; we use the maximum D-Bus packet size as that's larger + * than the maximum packet size for other link-layer types, and the maximum + * packet size for other link-layer types is currently small enough that + * the resulting block size would be less than the previous 16 MiB limit. + */ +#define MAX_BLOCK_SIZE (MIN_EPB_SIZE + WTAP_MAX_PACKET_SIZE_DBUS + 131072) + /* Note: many of the defined structures for block data are defined in wtap.h */ /* Packet data - used for both Enhanced Packet Block and the obsolete Packet Block data */ |