(/home/sate/Testcases/c/cve/wireshark-1.2.0/proto_hier_stats.c) |
| |
| 81 | | | process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, guint pkt_len) |
| 82 | | | { |
| 83 | | | field_info *finfo; |
| 84 | | | ph_stats_node_t *stats; |
| 85 | | | proto_node *proto_sibling_node; |
| 86 | | | GNode *stat_node; |
| 87 | | | |
| 88 | | | finfo = PITEM_FINFO(ptree_node); |
| 89 | | | g_assert(finfo);
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
74 | #define g_assert(expr) do { if G_LIKELY (expr) ; else \ |
75 | g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ |
76 | #expr); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
277 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
268 | #define _G_BOOLEAN_EXPR(expr) \ |
269 | __extension__ ({ \ |
270 | int _g_boolean_var_; \ |
271 | if (expr) \ |
272 | _g_boolean_var_ = 1; \ |
273 | else \ |
274 | _g_boolean_var_ = 0; \ |
275 | _g_boolean_var_; \ |
276 | }) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 90 | | | |
| 91 | | | |
| 92 | | | |
| 93 | | | |
| 94 | | | if (finfo->hfinfo->parent != -1) { |
| 95 | | | |
| 96 | | | stat_node = parent_stat_node; |
| 97 | | | stats = STAT_NODE_STATS(stat_node); |
| 98 | | | } else { |
| 99 | | | stat_node = find_stat_node(parent_stat_node, finfo->hfinfo); |
| 100 | | | |
| 101 | | | stats = STAT_NODE_STATS(stat_node); |
| 102 | | | stats->num_pkts_total++; |
| 103 | | | stats->num_bytes_total += pkt_len; |
| 104 | | | } |
| 105 | | | |
| 106 | | | proto_sibling_node = ptree_node->next; |
| 107 | | | |
| 108 | | | if (proto_sibling_node) { |
| 109 | | | |
| 110 | | | |
| 111 | | | |
| 112 | | | |
| 113 | | | if(strlen(proto_sibling_node->finfo->hfinfo->name) == 0 && ptree_node->next) |
Redundant Condition
ptree_node->next always evaluates to true. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that ptree_node->next cannot be false.
- A crashing bug occurs on every path where ptree_node->next could have evaluated to false. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 114 | | | proto_sibling_node = proto_sibling_node->next; |
| 115 | | | |
| 116 | | | process_node(proto_sibling_node, stat_node, ps, pkt_len); |
| 117 | | | } else { |
| 118 | | | stats->num_pkts_last++; |
| 119 | | | stats->num_bytes_last += pkt_len; |
| 120 | | | } |
| 121 | | | } |
| |