Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at text2pcap.c:1328

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

parse_options

(/home/sate/Testcases/c/cve/wireshark-1.2.0/text2pcap.c)expand/collapse
Show more  
 1104  parse_options (int argc, char *argv[])
 1105  {
 1106      int c;
 1107      char *p;
 1108   
 1109      /* Scan CLI parameters */
 1110      while ((c = getopt(argc, argv, "dhqe:i:l:m:o:u:s:S:t:T:")) != -1) {
 1111          switch(c) {
 1112          case '?': usage(); break;
 1113          case 'h': usage(); break;
 1114          case 'd': if (!quiet) debug++; break;
 1115          case 'q': quiet = TRUE; debug = FALSE; break;
 1116          case 'l': pcap_link_type = strtol(optarg, NULL, 0); break;
 1117          case 'm': max_offset = strtol(optarg, NULL, 0); break;
 1118          case 'o':
 1119              if (optarg[0]!='h' && optarg[0] != 'o' && optarg[0] != 'd') {
 1120                  fprintf(stderr, "Bad argument for '-o': %s\n", optarg);
 1121
1269
Show [ Lines 1121 to 1269 omitted. ]
 1270              hdr_ip_proto = 6;
 1271              hdr_ethernet = TRUE;
 1272              hdr_ethernet_proto = 0x800;
 1273              break;
 1274   
 1275          default:
 1276              usage();
 1277          }
 1278      }
 1279   
 1280      if (optind >= argc || argc-optind < 2) {
 1281          fprintf(stderr, "Must specify input and output filename\n");
 1282          usage();
 1283      }
 1284   
 1285      if (strcmp(argv[optind], "-")) {
 1286          input_filename = g_strdup(argv[optind]);
 1287          input_file = ws_fopen(input_filename, "rb");
 1288          if (!input_file) {
 1289              fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
 1290                      input_filename, strerror(errno));
 1291              exit(-1);
 1292          }
 1293      } else {
 1294          input_filename = "Standard input";
 1295          input_file = stdin;
 1296      }
 1297   
 1298      if (strcmp(argv[optind+1], "-")) {
 1299          output_filename = g_strdup(argv[optind+1]);
 1300          output_file = ws_fopen(output_filename, "wb");
 1301          if (!output_file) {
 1302              fprintf(stderr, "Cannot open file [%s] for writing: %s\n",
 1303                      output_filename, strerror(errno));
 1304              exit(-1);
 1305          }
 1306      } else {
 1307          output_filename = "Standard output";
 1308          output_file = stdout;
 1309      }
 1310   
 1311      /* Some validation */
 1312      if (pcap_link_type != 1 && hdr_ethernet) {
 1313          fprintf(stderr, "Dummy headers (-e, -i, -u, -s, -S -T) cannot be specified with link type override (-l)\n");
 1314          exit(-1);
 1315      }
 1316   
 1317      /* Set up our variables */
 1318      if (!input_file) {
 1319          input_file = stdin;
 1320          input_filename = "Standard input";
 1321      }
 1322      if (!output_file) {
 1323          output_file = stdout;
 1324          output_filename = "Standard output";
 1325      }
 1326   
 1327      ts_sec = time(0);           /* initialize to current time */
 1328      timecode_default = *localtime(&ts_sec);
Show more  




Change Warning 4907.30175 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: