diff options
author | Sontol Bonggol <sonbonggol@gmail.com> | 2017-08-10 23:35:16 -0700 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-08-11 11:52:19 +0000 |
commit | 5a0aa773c1e5f1102c1a0124554794672eaca931 (patch) | |
tree | 599dc3b5b70b665630203f1ef48d95690b2af5bf /text2pcap.c | |
parent | ef24608db1e4b881667ca7a670a76842ae52853d (diff) |
Do not allow -m option to be larger than our allocated buffer
Specifying -m larger than our allocated buffer may result in segfault.
This patch protects it from happening and exits early.
Change-Id: I2197605d90c98fc9d12b69a68fe533aaf6457df2
Reviewed-on: https://code.wireshark.org/review/23044
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'text2pcap.c')
-rw-r--r-- | text2pcap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/text2pcap.c b/text2pcap.c index 3bdd33748f..db23601738 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -1780,6 +1780,12 @@ parse_options (int argc, char *argv[]) return EXIT_FAILURE; } + if (max_offset > WTAP_MAX_PACKET_SIZE_STANDARD) { + fprintf(stderr, "Maximum packet length cannot be more than %d bytes\n", + WTAP_MAX_PACKET_SIZE_STANDARD); + return EXIT_FAILURE; + } + if (strcmp(argv[optind], "-") != 0) { input_filename = argv[optind]; input_file = ws_fopen(input_filename, "rb"); |