aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt_core
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-06-12 11:23:32 -0700
committerGuy Harris <guy@alum.mit.edu>2018-06-12 18:24:47 +0000
commit4e7f4881d2cf6fe69de0661c2441e82dd525e59e (patch)
tree1535fcb594c53442904458519485a60474f19864 /randpkt_core
parenta03eacc7aabd04a6fd0db978e0d7597220ac0515 (diff)
Don't let randpkt write packets libwiretap can't read.
Wiretap imposes an arbitrary limit on the maximum packet size, to prevent it from trying to allocate a huge packet buffer and possibly running out of address space on ILP32 platforms or just eating too much backing store on LP64/LLP64 platforms. Don't write packets with a length greater than that limit. Bug: 14107 Change-Id: Iba4fe3b008b044215647ba3f838ae7b3ac66c585 Reviewed-on: https://code.wireshark.org/review/28232 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'randpkt_core')
-rw-r--r--randpkt_core/randpkt_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c
index 628b941c23..b156fb9b67 100644
--- a/randpkt_core/randpkt_core.c
+++ b/randpkt_core/randpkt_core.c
@@ -593,6 +593,13 @@ void randpkt_loop(randpkt_example* example, guint64 produce_count)
}
len_this_pkt = example->sample_length + len_random;
+ if (len_this_pkt > WTAP_MAX_PACKET_SIZE_STANDARD) {
+ /*
+ * Wiretap will fail when trying to read packets
+ * bigger than WTAP_MAX_PACKET_SIZE_STANDARD.
+ */
+ len_this_pkt = WTAP_MAX_PACKET_SIZE_STANDARD;
+ }
rec->rec_header.packet_header.caplen = len_this_pkt;
rec->rec_header.packet_header.len = len_this_pkt;