aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-09-25 17:51:05 +0200
committerMichael Mann <mmann78@netscape.net>2017-09-25 16:29:32 +0000
commit33c00a6741b7cd31e28b7034bf25fc2f4b2ad767 (patch)
tree52aa716bb38b23147fc3461ddc7ff69e24bf16dd
parentf64906413067f59b7bce5d149fd86b22ec392952 (diff)
text2pcap: fix crash when there is no argument
Bug: 14082 Change-Id: Ifd8b2bf9bee817967e3b00e01b8b4ae90970e984 Reviewed-on: https://code.wireshark.org/review/23727 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--text2pcap.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/text2pcap.c b/text2pcap.c
index db23601738..8a946589ca 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -1881,7 +1881,10 @@ main(int argc, char *argv[])
{
int ret = EXIT_SUCCESS;
- parse_options(argc, argv);
+ if (parse_options(argc, argv) != EXIT_SUCCESS) {
+ ret = EXIT_FAILURE;
+ goto clean_exit;
+ }
assert(input_file != NULL);
assert(output_file != NULL);
@@ -1933,8 +1936,12 @@ main(int argc, char *argv[])
}
clean_exit:
text2pcap_lex_destroy();
- fclose(input_file);
- fclose(output_file);
+ if (input_file) {
+ fclose(input_file);
+ }
+ if (output_file) {
+ fclose(output_file);
+ }
return ret;
}