(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-tzsp.c) |
| |
| 280 | | | dissect_tzsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 281 | | | { |
| 282 | | | proto_tree *tzsp_tree = NULL; |
| 283 | | | proto_item *ti = NULL; |
| 284 | | | int pos = 0; |
| 285 | | | tvbuff_t *next_tvb; |
| 286 | | | guint16 encapsulation = 0; |
| 287 | | | int wtap_encap; |
| 288 | | | dissector_handle_t encap_dissector; |
| 289 | | | const char *encap_name; |
| 290 | | | const char *info; |
| 291 | | | guint8 type; |
| 292 | | | |
| 293 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 294 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "TZSP"); |
| 295 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 296 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 297 | | | |
| 298 | | | type = tvb_get_guint8(tvb, 1); |
| 299 | | | |
| 300 | | | |
| 301 | | | encapsulation = tvb_get_ntohs(tvb, 2); |
| 302 | | | if (encapsulation != 0) { |
| 303 | | | wtap_encap = tzsp_encap_to_wtap_encap(encapsulation); |
| 304 | | | if (wtap_encap != -1 && |
| 305 | | | (encap_dissector = dissector_get_port_handle(encap_dissector_table, wtap_encap))) { |
| 306 | | | encap_name = dissector_handle_get_short_name(encap_dissector); |
| 307 | | | } |
| 308 | | | else { |
| 309 | | | encap_name = "Unknown"; |
| 310 | | | } |
| 311 | | | info = encap_name; |
| 312 | | | } |
| 313 | | | else { |
| 314 | | | wtap_encap = -1; |
| 315 | | | encap_name = "Nothing"; |
| 316 | | | info = val_to_str(type, tzsp_type, "Unknown (%u)"); |
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 |
|
| 317 | | | } |
| 318 | | | |
| 319 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
Event 2:
Skipping " if". check_col(...) evaluates to false.
hide
|
|
| 320 | | | col_set_str(pinfo->cinfo, COL_INFO, info); |
| 321 | | | |
| 322 | | | if (tree) { |
Event 3:
Skipping " if". tree evaluates to false.
hide
|
|
| 323 | | | |
| 324 | | | ti = proto_tree_add_protocol_format(tree, proto_tzsp, tvb, 0, |
| 325 | | | -1, "TZSP: %s: ", info); |
| 326 | | | tzsp_tree = proto_item_add_subtree(ti, ett_tzsp); |
| 327 | | | |
| 328 | | | proto_tree_add_item (tzsp_tree, hf_tzsp_version, tvb, 0, 1, |
| 329 | | | FALSE); |
| 330 | | | proto_tree_add_uint (tzsp_tree, hf_tzsp_type, tvb, 1, 1, |
| 331 | | | type); |
| 332 | | | proto_tree_add_uint_format (tzsp_tree, hf_tzsp_encap, tvb, 2, 2, |
| 333 | | | encapsulation, "Encapsulates: %s (%d)", |
| 334 | | | encap_name, encapsulation); |
| 335 | | | } |
| 336 | | | |
| 337 | | | if (type != 4 && type != 5) { |
| 338 | | | pos = add_option_info(tvb, 4, tzsp_tree, ti); |
| 339 | | | |
| 340 | | | if (tree) |
Event 5:
Skipping " if". tree evaluates to false.
hide
|
|
| 341 | | | proto_item_set_end(ti, tvb, pos); |
| 342 | | | next_tvb = tvb_new_subset(tvb, pos, -1, -1); |
| 343 | | | if (encapsulation != 0 |
Event 6:
Skipping " if". encapsulation != 0 evaluates to false.
hide
|
|
| 344 | | | && (wtap_encap == -1 |
| 345 | | | || !dissector_try_port(encap_dissector_table, wtap_encap, |
| 346 | | | next_tvb, pinfo, tree))) { |
| 347 | | | |
| 348 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 349 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); |
| 350 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 351 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "TZSP_ENCAP = %u", |
| 352 | | | encapsulation); |
| 353 | | | call_dissector(data_handle, next_tvb, pinfo, tree); |
| 354 | | | } |
| 355 | | | } |
| 356 | | | } |
| |