Fix mergecap.c: Dereference of null pointer (clang analyzer)
authorHadriel Kaplan <hadrielk@yahoo.com>
Tue, 25 Feb 2014 16:10:50 +0000 (11:10 -0500)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Tue, 25 Feb 2014 21:11:25 +0000 (21:11 +0000)
Change-Id: I89076388db8522c5fbdf72505f50e1380f1ab391
Reviewed-on: https://code.wireshark.org/review/369
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
mergecap.c

index afc3bad29a699c235c80479eae739876b1fd9bbb..37fa8839dd756c48b7d93a98d6a78511d50b9731 100644 (file)
@@ -512,7 +512,7 @@ main(int argc, char *argv[])
        * report the frame number and file type/subtype.
        */
       fprintf(stderr, "mergecap: Frame %u of \"%s\" has a network type that can't be saved in a \"%s\" file.\n",
-              in_file->packet_num, in_file->filename,
+              in_file ? in_file->packet_num : 0, in_file ? in_file->filename : "UNKNOWN",
               wtap_file_type_subtype_string(file_type));
       break;
 
@@ -523,7 +523,7 @@ main(int argc, char *argv[])
        * report the frame number and file type/subtype.
        */
       fprintf(stderr, "mergecap: Frame %u of \"%s\" is too large for a \"%s\" file\n.",
-              in_file->packet_num, in_file->filename,
+              in_file ? in_file->packet_num : 0, in_file ? in_file->filename : "UNKNOWN",
               wtap_file_type_subtype_string(file_type));
       break;