(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/asn1/packet-asn1.c) |
| |
| 2803 | | | read_asn1_type_table(const char *filename) |
| 2804 | | | { |
| 2805 | | | FILE *f; |
| 2806 | | | guint size; |
| 2807 | | | guchar *data; |
| 2808 | | | struct stat stat; |
| 2809 | | | static guint mylogh = 0; |
| 2810 | | | |
| 2811 | | | if ((filename == 0) || (strlen(filename) == 0)) |
| 2812 | | | return; |
| 2813 | | | |
| 2814 | | | f = ws_fopen(filename, "rb"); |
| 2815 | | | if (f == 0) { |
| 2816 | | | |
| 2817 | | | |
| 2818 | | | |
| 2819 | | | |
| 2820 | | | |
| 2821 | | | |
| 2822 | | | |
| 2823 | | | #ifdef _WIN32 |
| 2824 | | | if (strcmp(filename, bad_separator_old_default_asn1_filename) != 0) |
| 2825 | | | #endif |
| 2826 | | | if ((strcmp(filename, old_default_asn1_filename) != 0) || errno != ENOENT)
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
| 2827 | | | report_open_failure(filename, errno, FALSE); |
| 2828 | | | return; |
| 2829 | | | } |
| 2830 | | | fstat(fileno(f), &stat); |
Ignored Return Value
The return value of fstat() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- CodeSonar is configured to enforce Ignored Return Value checks for fstat(). (To change the set of enforced Ignored Return Value checks, use configuration file parameters RETURN_CHECKER_CHECKED_FUNCS and RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 2831 | | | size = (int)stat.st_size; |
| 2832 | | | if (size == 0) { |
Event 2:
Skipping " if". size == 0 evaluates to false.
hide
|
|
| 2833 | | | if (asn1_verbose) g_message("file %s is empty, ignored", filename);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 2834 | | | fclose(f); |
| 2835 | | | return; |
| 2836 | | | } |
| 2837 | | | if (asn1_verbose) g_message("reading %d bytes from %s", size, filename);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
Event 3:
Taking true branch. asn1_verbose evaluates to true.
hide
|
|
| 2838 | | | |
| 2839 | | | data = g_malloc(size); |
| 2840 | | | if (fread(data, size, 1, f) < 1) { |
Event 4:
Taking true branch. fread(data, size, 1, f) < 1 evaluates to true.
hide
|
|
| 2841 | | | g_warning("error reading %s, %s", filename, strerror(errno));
x /usr/include/glib-2.0/glib/gmessages.h |
| |
153 | #define g_warning(...) g_log (G_LOG_DOMAIN, \ |
154 | G_LOG_LEVEL_WARNING, \ |
155 | __VA_ARGS__) |
| |
|
| 2842 | | | } |
| 2843 | | | fclose(f); |
| 2844 | | | |
| 2845 | | | if (asn1_verbose) { |
Event 5:
Taking true branch. asn1_verbose evaluates to true.
hide
|
|
| 2846 | | | |
| 2847 | | | |
| 2848 | | | |
| 2849 | | | |
| 2850 | | | |
| 2851 | | | |
| 2852 | | | |
| 2853 | | | g_message("logging to file %s", asn1_logfile);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
| 2854 | | | |
| 2855 | | | if (mylogh == 0) { |
Event 6:
Taking true branch. mylogh == 0 evaluates to true.
hide
|
|
| 2856 | | | mylogh = g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
| 2857 | | | | G_LOG_FLAG_RECURSION, my_log_handler, NULL); |
| 2858 | | | } |
| 2859 | | | } |
| 2860 | | | |
| 2861 | | | asn1_desc = tvb_new_real_data(data, size, size); |
| 2862 | | | |
| 2863 | | | tt_build_tree(); |
| 2864 | | | if (asn1_verbose) g_message("read %d items from %s", icount, filename);
x /usr/include/glib-2.0/glib/gmessages.h |
| |
147 | #define g_message(...) g_log (G_LOG_DOMAIN, \ |
148 | G_LOG_LEVEL_MESSAGE, \ |
149 | __VA_ARGS__) |
| |
|
Event 7:
Taking true branch. asn1_verbose evaluates to true.
hide
|
|
| 2865 | | | |
| 2866 | | | #if 0 |
| 2867 | | | list_modules(); |
| 2868 | | | #endif |
| 2869 | | | |
| 2870 | | | get_values(); |
| 2871 | | | |
| 2872 | | | g_node_destroy(asn1_nodes); asn1_nodes = 0; |
| 2873 | | | #ifndef _WIN32 |
| 2874 | | | tvb_free(asn1_desc); |
| 2875 | | | #endif |
| 2876 | | | asn1_desc = 0; |
| 2877 | | | g_free(data); data = 0; |
| 2878 | | | |
| 2879 | | | showGNodes(data_nodes, 0); |
| 2880 | | | |
| 2881 | | | debug_dump_TT(); |
| 2882 | | | } |
| |