Text   |  XML   |  ReML   |   Visible Warnings:

Uninitialized Variable  at dumpcap.c:2633

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

main

(/home/sate/Testcases/c/cve/wireshark-1.2.0/dumpcap.c)expand/collapse
Show more  
 2512  main(int argc, char *argv[])
 2513  {
 2514    int                  opt;
 2515    extern char         *optarg;
 2516    gboolean             arg_error = FALSE;
 2517   
 2518  #ifdef _WIN32 
 2519    WSADATA              wsaData;
 2520  #else
 2521    struct sigaction action, oldaction;
 2522  #endif
 2523   
 2524    gboolean             start_capture = TRUE;
 2525    gboolean             stats_known;
 2526    struct pcap_stat     stats;
 2527    GLogLevelFlags       log_flags;
 2528    gboolean             list_interfaces = FALSE;
 2529    gboolean             list_link_layer_types = FALSE;
 2530    gboolean             machine_readable = FALSE;
 2531    gboolean             print_statistics = FALSE;
 2532    int                  status, run_once_args = 0;
 2533    gint                 i;
 2534   
 2535  #ifdef HAVE_PCAP_REMOTE 
 2536  #define OPTSTRING_INIT "a:A:b:c:Df:hi:Lm:MnprSs:uvw:y:Z:"
 2537  #else
 2538  #define OPTSTRING_INIT "a:b:c:Df:hi:LMnpSs:vw:y:Z:"
 2539  #endif
 2540   
 2541  #ifdef _WIN32 
 2542  #define OPTSTRING_WIN32 "B:"
 2543  #else
 2544  #define OPTSTRING_WIN32 ""
 2545  #endif  /* _WIN32 */
 2546   
 2547    char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_WIN32) - 1] =
 2548      OPTSTRING_INIT OPTSTRING_WIN32;
 2549   
 2550  #ifdef DEBUG_CHILD_DUMPCAP 
 2551    if ((debug_log = ws_fopen("dumpcap_debug_log.tmp","w")) == NULL) {
 2552            fprintf (stderr, "Unable to open debug log file !\n");
 2553            exit (1);
 2554    }
 2555  #endif
 2556   
 2557    /* Determine if dumpcap is being requested to run in a special       */
 2558    /* capture_child mode by going thru the command line args to see if  */
 2559    /* a -Z is present. (-Z is a hidden option).                         */
 2560    /* The primary result of running in capture_child mode is that       */
 2561    /* all messages sent out on stderr are in a special type/len/string  */
 2562    /* format to allow message processing by type.                       */
 2563    /* These messages include various 'status' messages which are sent   */
 2564    /* when an actual capture is in progress. Capture_child mode         */
 2565    /* would normally be requested by a parent process which invokes     */
 2566    /* dumpcap and obtains dumpcap stderr output via a pipe to which     */
 2567    /* dumpcap stderr has been redirected.                               */
 2568    /* Capture_child mode needs to be determined immediately upon        */
 2569    /* startup so that any messages generated by dumpcap in this mode    */
 2570    /* (eg: during initialization) will be formatted properly.           */
 2571   
 2572    for (i=1; i<argc; i++) {
 2573      if (strcmp("-Z", argv[i]) == 0) {
 2574        capture_child = TRUE;
 2575  #ifdef _WIN32 
 2576        /* set output pipe to binary mode, to avoid ugly text conversions */
 2577        _setmode(2, O_BINARY);
 2578  #endif
 2579      }
 2580    }
 2581   
 2582    /* The default_log_handler will use stdout, which makes trouble in   */
 2583    /* capture child mode, as it uses stdout for it's sync_pipe.         */
 2584    /* So: the filtering is done in the console_log_handler and not here.*/
 2585    /* We set the log handlers right up front to make sure that any log  */
 2586    /* messages when running as child will be sent back to the parent    */
 2587    /* with the correct format.                                          */
 2588   
 2589    log_flags =
 2590                      G_LOG_LEVEL_ERROR|
 2591                      G_LOG_LEVEL_CRITICAL|
 2592                      G_LOG_LEVEL_WARNING|
 2593                      G_LOG_LEVEL_MESSAGE|
 2594                      G_LOG_LEVEL_INFO|
 2595                      G_LOG_LEVEL_DEBUG|
 2596                      G_LOG_FLAG_FATAL|G_LOG_FLAG_RECURSION;
 2597   
 2598    g_log_set_handler(NULL,
 2599                      log_flags,
 2600                      console_log_handler, NULL /* user_data */);
 2601    g_log_set_handler(LOG_DOMAIN_MAIN,
 2602                      log_flags,
 2603                      console_log_handler, NULL /* user_data */);
 2604    g_log_set_handler(LOG_DOMAIN_CAPTURE,
 2605                      log_flags,
 2606                      console_log_handler, NULL /* user_data */);
 2607    g_log_set_handler(LOG_DOMAIN_CAPTURE_CHILD,
 2608                      log_flags,
 2609                      console_log_handler, NULL /* user_data */);
 2610   
 2611  #ifdef _WIN32 
 2612    /* Load wpcap if possible. Do this before collecting the run-time version information */
 2613    load_wpcap();
 2614   
 2615    /* ... and also load the packet.dll from wpcap */
 2616    /* XXX - currently not required, may change later. */
 2617    /*wpcap_packet_load();*/
 2618   
 2619    /* Start windows sockets */
 2620    WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
 2621   
 2622    /* Set handler for Ctrl+C key */
 2623    SetConsoleCtrlHandler(capture_cleanup, TRUE);
 2624  #else
 2625    /* Catch SIGINT and SIGTERM and, if we get either of them, clean up
 2626       and exit. */
 2627    action.sa_handler = capture_cleanup;
 2628    action.sa_flags = 0;
 2629    sigemptyset(&action.sa_mask);
 2630    sigaction(SIGTERM, &action, NULL);
 2631    sigaction(SIGINT, &action, NULL);
 2632    sigaction(SIGHUP, NULL, &oldaction);
 2633    if (oldaction.sa_handler == SIG_DFL)
Show more  




Change Warning 5034.30588 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: