(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c) |
| |
| 5785 | | | proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, int offset, int len, gint ett, |
| 5786 | | | const int **fields, gboolean little_endian, int flags, gboolean first) |
| 5787 | | | { |
| 5788 | | | guint32 value = 0, tmpval; |
| 5789 | | | proto_tree *tree = NULL; |
| 5790 | | | *hf; |
| 5791 | | | const char *fmt; |
| 5792 | | | |
| 5793 | | | switch (len) { |
| 5794 | | | case 1: |
| 5795 | | | value = tvb_get_guint8(tvb, offset); |
| 5796 | | | break; |
| 5797 | | | case 2: |
| 5798 | | | value = little_endian ? tvb_get_letohs(tvb, offset) : |
| 5799 | | | tvb_get_ntohs(tvb, offset); |
| 5800 | | | break; |
| 5801 | | | case 3: |
| 5802 | | | value = little_endian ? tvb_get_letoh24(tvb, offset) : |
| 5803 | | | tvb_get_ntoh24(tvb, offset); |
| 5804 | | | break; |
| 5805 | | | case 4: |
| 5806 | | | value = little_endian ? tvb_get_letohl(tvb, offset) : |
| 5807 | | | tvb_get_ntohl(tvb, offset); |
| 5808 | | | break; |
| 5809 | | | default: |
| 5810 | | | g_assert_not_reached();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 5811 | | | } |
| 5812 | | | |
| 5813 | | | tree = proto_item_add_subtree(item, ett); |
| 5814 | | | while (*fields) { |
| 5815 | | | proto_tree_add_item(tree, **fields, tvb, offset, len, little_endian); |
| 5816 | | | if (flags & BMT_NO_APPEND) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
1586 | #define BMT_NO_APPEND 0x01 /**< Don't change the title at all */ |
| |
|
| 5817 | | | fields++; |
| 5818 | | | continue; |
| 5819 | | | } |
| 5820 | | | hf = proto_registrar_get_nth(**fields); |
| 5821 | | | DISSECTOR_ASSERT(hf->bitmask != 0);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
117 | #define DISSECTOR_ASSERT(expression) \ |
118 | ((void) ((expression) ? (void)0 : \ |
119 | __DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
138 | #define __DISSECTOR_ASSERT(expression, file, lineno) \ |
139 | (REPORT_DISSECTOR_BUG( \ |
140 | ep_strdup_printf("%s:%u: failed assertion \"%s\"", \ |
141 | file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression)))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 5822 | | | tmpval = (value & hf->bitmask) >> hf->bitshift; |
| 5823 | | | |
| 5824 | | | switch (hf->type) { |
| 5825 | | | case FT_INT8: |
| 5826 | | | case FT_UINT8: |
| 5827 | | | case FT_INT16: |
| 5828 | | | case FT_UINT16: |
| 5829 | | | case FT_INT24: |
| 5830 | | | case FT_UINT24: |
| 5831 | | | case FT_INT32: |
| 5832 | | | case FT_UINT32: |
| 5833 | | | DISSECTOR_ASSERT(len == ftype_length(hf->type));
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
117 | #define DISSECTOR_ASSERT(expression) \ |
118 | ((void) ((expression) ? (void)0 : \ |
119 | __DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
138 | #define __DISSECTOR_ASSERT(expression, file, lineno) \ |
139 | (REPORT_DISSECTOR_BUG( \ |
140 | ep_strdup_printf("%s:%u: failed assertion \"%s\"", \ |
141 | file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression)))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 5834 | | | |
| 5835 | | | if (hf->display == BASE_CUSTOM) { |
| 5836 | | | gchar lbl[ITEM_LABEL_LENGTH]; |
| 5837 | | | custom_fmt_func_t fmtfunc = (custom_fmt_func_t)hf->strings; |
| 5838 | | | |
| 5839 | | | DISSECTOR_ASSERT(fmtfunc);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
117 | #define DISSECTOR_ASSERT(expression) \ |
118 | ((void) ((expression) ? (void)0 : \ |
119 | __DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
138 | #define __DISSECTOR_ASSERT(expression, file, lineno) \ |
139 | (REPORT_DISSECTOR_BUG( \ |
140 | ep_strdup_printf("%s:%u: failed assertion \"%s\"", \ |
141 | file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression)))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 5840 | | | fmtfunc(lbl, tmpval); |
| 5841 | | | proto_item_append_text(item, "%s%s: %s", first ? "" : ", ", |
| 5842 | | | hf->name, lbl); |
| 5843 | | | first = FALSE; |
| 5844 | | | } |
| 5845 | | | else if (hf->strings) { |
| 5846 | | | if (hf->display & BASE_RANGE_STRING) { |
| 5847 | | | proto_item_append_text(item, "%s%s: %s", first ? "" : ", ", |
| 5848 | | | hf->name, rval_to_str(tmpval, hf->strings, "Unknown")); |
| 5849 | | | } else { |
| 5850 | | | proto_item_append_text(item, "%s%s: %s", first ? "" : ", ", |
| 5851 | | | hf->name, val_to_str(tmpval, cVALS(hf->strings), "Unknown")); |
| 5852 | | | } |
| 5853 | | | first = FALSE; |
| 5854 | | | } |
| 5855 | | | else if (!(flags & BMT_NO_INT)) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
1587 | #define BMT_NO_INT 0x02 /**< Don't add integral (non-boolean) fields to title */ |
| |
|
| 5856 | | | if (!first) { |
| 5857 | | | proto_item_append_text(item, ", "); |
| 5858 | | | } |
| 5859 | | | |
| 5860 | | | fmt = IS_FT_INT(hf->type) ? hfinfo_int_format(hf) : hfinfo_uint_format(hf);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/ftypes/ftypes.h |
| |
69 | #define IS_FT_INT(ft) ((ft)==FT_INT8||(ft)==FT_INT16||(ft)==FT_INT24||(ft)==FT_INT32||(ft)==FT_INT64) |
| |
|
| 5861 | | | if (IS_BASE_DUAL(hf->display)) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
162 | #define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC) |
| |
|
| 5862 | | | proto_item_append_text(item, fmt, hf->name, tmpval, tmpval); |
| 5863 | | | } else { |
| 5864 | | | proto_item_append_text(item, fmt, hf->name, tmpval); |
Format String
proto_item_append_text() is being called with a format string that is not constant. The format string (second argument) may not match the other arguments to proto_item_append_text(); this could lead to security or stability problems. proto_item_append_text() is usually called with strings that look like format strings in this project. |
|
| 5865 | | | } |
| 5866 | | | first = FALSE; |
| 5867 | | | } |
| 5868 | | | |
| 5869 | | | break; |
| 5870 | | | case FT_BOOLEAN: |
| 5871 | | | DISSECTOR_ASSERT(len * 8 == hf->display);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
117 | #define DISSECTOR_ASSERT(expression) \ |
118 | ((void) ((expression) ? (void)0 : \ |
119 | __DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
138 | #define __DISSECTOR_ASSERT(expression, file, lineno) \ |
139 | (REPORT_DISSECTOR_BUG( \ |
140 | ep_strdup_printf("%s:%u: failed assertion \"%s\"", \ |
141 | file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression)))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 5872 | | | |
| 5873 | | | if (hf->strings && !(flags & BMT_NO_TFS)) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
1589 | #define BMT_NO_TFS 0x08 /**< Don't use true_false_string while formatting booleans */ |
| |
|
| 5874 | | | |
| 5875 | | | |
| 5876 | | | const struct true_false_string *tfs = |
| 5877 | | | (const struct true_false_string *)hf->strings; |
| 5878 | | | |
| 5879 | | | if (tmpval) { |
| 5880 | | | proto_item_append_text(item, "%s%s: %s", first ? "" : ", ", |
| 5881 | | | hf->name, tfs->true_string); |
| 5882 | | | first = FALSE; |
| 5883 | | | } else if (!(flags & BMT_NO_FALSE)) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
1588 | #define BMT_NO_FALSE 0x04 /**< Don't add booleans unless they're TRUE */ |
| |
|
| 5884 | | | proto_item_append_text(item, "%s%s: %s", first ? "" : ", ", |
| 5885 | | | hf->name, tfs->false_string); |
| 5886 | | | first = FALSE; |
| 5887 | | | } |
| 5888 | | | } else if (hf->bitmask & value) { |
| 5889 | | | |
| 5890 | | | proto_item_append_text(item, "%s%s", first ? "" : ", ", hf->name); |
| 5891 | | | first = FALSE; |
| 5892 | | | } |
| 5893 | | | break; |
| 5894 | | | default: |
| 5895 | | | g_assert_not_reached();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 5896 | | | } |
| 5897 | | | |
| 5898 | | | fields++; |
| 5899 | | | } |
| 5900 | | | |
| 5901 | | | return first; |
| 5902 | | | } |
| |