(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-pgsql.c) |
| |
| 215 | | | dissect_pgsql_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 216 | | | { |
| 217 | | | proto_item *ti, *hidden_item; |
| 218 | | | proto_tree *ptree; |
| 219 | | | |
| 220 | | | gint n; |
| 221 | | | guchar type; |
| 222 | | | const char *typestr; |
| 223 | | | guint length; |
| 224 | | | gboolean info = check_col(pinfo->cinfo, COL_INFO); |
| 225 | | | gboolean fe = (pinfo->match_port == pinfo->destport); |
| 226 | | | |
| 227 | | | n = 0; |
| 228 | | | type = tvb_get_guint8(tvb, 0); |
| 229 | | | if (type != '\0') |
| 230 | | | n += 1; |
| 231 | | | length = tvb_get_ntohl(tvb, n); |
| 232 | | | |
| 233 | | | |
| 234 | | | |
| 235 | | | |
| 236 | | | if (fe) { |
| 237 | | | |
| 238 | | | |
| 239 | | | |
| 240 | | | if (type == '\0') { |
| 241 | | | guint tag = tvb_get_ntohl(tvb, 4); |
| 242 | | | |
| 243 | | | if (length == 16 && tag == 80877102) |
| 244 | | | typestr = "Cancel request"; |
| 245 | | | else if (length == 8 && tag == 80877103) |
| 246 | | | typestr = "SSL request"; |
| 247 | | | else if (tag == 196608) |
| 248 | | | typestr = "Startup message"; |
| 249 | | | else |
| 250 | | | typestr = "Unknown"; |
| 251 | | | } else |
| 252 | | | typestr = val_to_str(type, fe_messages, "Unknown"); |
Ignored Return Value
The return value of val_to_str() 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.
- The return value of val_to_str() is checked 98% of the time in this project. CodeSonar is configured to enforce Ignored Return Value checks for any function whose return value is checked at least 96% of the time, unless the function is used fewer than 20 times. (To modify these thresholds, use configuration file parameters RETURN_CHECKER_SAMPLE_SIZE and RETURN_CHECKER_RATIO. To exempt val_to_str() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 253 | | | } |
| 254 | | | else { |
| 255 | | | typestr = val_to_str(type, be_messages, "Unknown"); |
| 256 | | | } |
| 257 | | | |
| 258 | | | if (info) { |
Event 2:
Taking true branch. info evaluates to true.
hide
|
|
| 259 | | | |
| 260 | | | |
| 261 | | | |
| 262 | | | col_append_fstr(pinfo->cinfo, COL_INFO, "%s%c", |
| 263 | | | ( first_message ? "" : "/" ), type); |
Event 3:
first_message evaluates to false.
hide
|
|
| 264 | | | first_message = FALSE; |
| 265 | | | } |
| 266 | | | |
| 267 | | | if (tree) { |
Event 4:
Skipping " if". tree evaluates to false.
hide
|
|
| 268 | | | ti = proto_tree_add_item(tree, proto_pgsql, tvb, 0, -1, FALSE); |
| 269 | | | ptree = proto_item_add_subtree(ti, ett_pgsql); |
| 270 | | | |
| 271 | | | n = 1; |
| 272 | | | if (type == '\0') |
| 273 | | | n = 0; |
| 274 | | | proto_tree_add_text(ptree, tvb, 0, n, "Type: %s", typestr); |
| 275 | | | hidden_item = proto_tree_add_item(ptree, hf_type, tvb, 0, n, FALSE); |
| 276 | | | PROTO_ITEM_SET_HIDDEN(hidden_item);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 277 | | | proto_tree_add_item(ptree, hf_length, tvb, n, 4, FALSE); |
| 278 | | | hidden_item = proto_tree_add_boolean(ptree, hf_frontend, tvb, 0, 0, fe); |
| 279 | | | PROTO_ITEM_SET_HIDDEN(hidden_item);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 280 | | | n += 4; |
| 281 | | | |
| 282 | | | if (fe) |
| 283 | | | dissect_pgsql_fe_msg(type, length, tvb, n, ptree); |
| 284 | | | else |
| 285 | | | dissect_pgsql_be_msg(type, length, tvb, n, ptree); |
| 286 | | | } |
| 287 | | | } |
| |