(/home/sate/Testcases/c/cve/wireshark-1.2.0/dumpcap.c) |
| |
| 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; |
Event 1:
!0 evaluates to true.
hide
|
|
| 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::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 |
| 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 | | | |
| 2558 | | | |
| 2559 | | | |
| 2560 | | | |
| 2561 | | | |
| 2562 | | | |
| 2563 | | | |
| 2564 | | | |
| 2565 | | | |
| 2566 | | | |
| 2567 | | | |
| 2568 | | | |
| 2569 | | | |
| 2570 | | | |
| 2571 | | | |
| 2572 | | | for (i=1; i<argc; i++) { |
Event 2:
Leaving loop. i < argc evaluates to false.
hide
|
|
| 2573 | | | if (strcmp("-Z", argv[i]) == 0) { |
| 2574 | | | capture_child = TRUE; |
| 2575 | | | #ifdef _WIN32 |
| 2576 | | | |
| 2577 | | | _setmode(2, O_BINARY); |
| 2578 | | | #endif |
| 2579 | | | } |
| 2580 | | | } |
| 2581 | | | |
| 2582 | | | |
| 2583 | | | |
| 2584 | | | |
| 2585 | | | |
| 2586 | | | |
| 2587 | | | |
| 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 ); |
| 2601 | | | g_log_set_handler(LOG_DOMAIN_MAIN, |
| 2602 | | | log_flags, |
| 2603 | | | console_log_handler, NULL ); |
| 2604 | | | g_log_set_handler(LOG_DOMAIN_CAPTURE, |
| 2605 | | | log_flags, |
| 2606 | | | console_log_handler, NULL ); |
| 2607 | | | g_log_set_handler(LOG_DOMAIN_CAPTURE_CHILD,
x /home/sate/Testcases/c/cve/wireshark-1.2.0/log.h |
| |
32 | #define LOG_DOMAIN_CAPTURE_CHILD "CaptureChild" |
| |
|
| 2608 | | | log_flags, |
| 2609 | | | console_log_handler, NULL ); |
| 2610 | | | |
| 2611 | | | #ifdef _WIN32 |
| 2612 | | | |
| 2613 | | | load_wpcap(); |
| 2614 | | | |
| 2615 | | | |
| 2616 | | | |
| 2617 | | | |
| 2618 | | | |
| 2619 | | | |
| 2620 | | | WSAStartup( MAKEWORD( 1, 1 ), &wsaData ); |
| 2621 | | | |
| 2622 | | | |
| 2623 | | | SetConsoleCtrlHandler(capture_cleanup, TRUE); |
| 2624 | | | #else |
| 2625 | | | |
| 2626 | | | |
| 2627 | | | action.sa_handler = capture_cleanup;
x /usr/include/bits/sigaction.h |
| |
37 | # define sa_handler __sigaction_handler.sa_handler |
| |
|
| 2628 | | | action.sa_flags = 0; |
| 2629 | | | sigemptyset(&action.sa_mask); |
| 2630 | | | sigaction(SIGTERM, &action, NULL);
x /usr/include/bits/signum.h |
| |
48 | #define SIGTERM 15 /* Termination (ANSI). */ |
| |
|
| 2631 | | | sigaction(SIGINT, &action, NULL);
x /usr/include/bits/signum.h |
| |
34 | #define SIGINT 2 /* Interrupt (ANSI). */ |
| |
|
| 2632 | | | sigaction(SIGHUP, NULL, &oldaction);
x /usr/include/bits/signum.h |
| |
33 | #define SIGHUP 1 /* Hangup (POSIX). */ |
| |
|
Event 7:
sigaction() does not initialize oldaction. - This may be because of a failure case or other special case for sigaction(). Consult the sigaction() documentation for more information.
hide
|
|
| 2633 | | | if (oldaction.sa_handler == SIG_DFL)
x /usr/include/bits/sigaction.h |
| |
37 | # define sa_handler __sigaction_handler.sa_handler |
| |
x /usr/include/bits/signum.h |
| |
24 | #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ |
| |
|
Uninitialized Variable
oldaction was not initialized. The issue can occur if the highlighted code executes. See related event 7. Show: All events | Only primary events |
|
| |