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>
This commit is contained in:
parent
ef24608db1
commit
5a0aa773c1
|
@ -1780,6 +1780,12 @@ parse_options (int argc, char *argv[])
|
||||||
return EXIT_FAILURE;
|
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) {
|
if (strcmp(argv[optind], "-") != 0) {
|
||||||
input_filename = argv[optind];
|
input_filename = argv[optind];
|
||||||
input_file = ws_fopen(input_filename, "rb");
|
input_file = ws_fopen(input_filename, "rb");
|
||||||
|
|
Loading…
Reference in New Issue