(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c) |
| |
| 3581 | | | wkh_profile_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) |
| 3582 | | | { |
| 3583 | | | wkh_0_Declarations;
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1881 | #define wkh_0_Declarations /* Declarations for Parsing */ \ |
1882 | gboolean ok = FALSE; /* Triggers error notification code at end */ \ |
1883 | proto_item *ti = NULL; /* Needed for error notification at end */ \ |
1884 | proto_item *hidden_item = NULL; \ |
1885 | guint32 val_start = hdr_start + 1; \ |
1886 | guint8 hdr_id = tvb_get_guint8 (tvb, hdr_start) & 0x7F; \ |
1887 | guint8 val_id = tvb_get_guint8 (tvb, val_start); \ |
1888 | guint32 offset = val_start; /* Offset to one past this */ \ |
1889 | guint32 val_len; /* length for value with length field */ \ |
1890 | guint32 val_len_len; /* length of length field */ \ |
1891 | const gchar *val_str = NULL |
| |
|
| 3584 | | | guint32 off, len, val = 0; |
| 3585 | | | nstime_t tv; |
| 3586 | | | guint8 warn_code; |
| 3587 | | | gchar *str; |
| 3588 | | | |
| 3589 | | | wkh_1_WellKnownValue;
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1893 | #define wkh_1_WellKnownValue /* Parse Well Known Value */ \ |
1894 | hidden_item = proto_tree_add_string(tree, hf_hdr_name, \ |
1895 | tvb, hdr_start, offset - hdr_start, \ |
1896 | val_to_str (hdr_id, vals_field_names, \ |
1897 | "<Unknown WSP field 0x%02X>")); \ |
1898 | PROTO_ITEM_SET_HIDDEN(hidden_item); \ |
1899 | if (val_id & 0x80) { /* Well-known value */ \ |
1900 | offset++; \ |
1901 | /* Well-known value processing starts HERE \ |
1902 | * \ |
1903 | * BEGIN */ |
| |
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) |
| |
|
| 3590 | | | val = val_id & 0x7F; |
| 3591 | | | val_str = match_strval(val, vals_wsp_profile_warning_code); |
| 3592 | | | if (val_str) { |
| 3593 | | | tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); |
| 3594 | | | ti = proto_tree_add_string(tree, hf_hdr_profile_warning, |
| 3595 | | | tvb, hdr_start, offset - hdr_start, val_str); |
| 3596 | | | ok = TRUE; |
| 3597 | | | } |
| 3598 | | | wkh_2_TextualValue;
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1905 | #define wkh_2_TextualValue /* Parse Textual Value */ \ |
1906 | /* END */ \ |
1907 | } else if ((val_id == 0) || (val_id >= 0x20)) { /* Textual value */ \ |
1908 | val_str = (gchar *)tvb_get_ephemeral_stringz (tvb, val_start, (gint *)&val_len); \ |
1909 | offset = val_start + val_len; \ |
1910 | /* Textual value processing starts HERE \ |
1911 | * \ |
1912 | * BEGIN */ |
| |
|
| 3599 | | | |
| 3600 | | | wkh_3_ValueWithLength;
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1914 | #define wkh_3_ValueWithLength /* Parse Value With Length */ \ |
1915 | /* END */ \ |
1916 | } else { /* val_start points to 1st byte of length field */ \ |
1917 | if (val_id == 0x1F) { /* Value Length = guintvar */ \ |
1918 | val_len = tvb_get_guintvar(tvb, val_start + 1, &val_len_len); \ |
1919 | val_len_len++; /* 0x1F length indicator byte */ \ |
1920 | } else { /* Short length followed by Len data octets */ \ |
1921 | val_len = tvb_get_guint8(tvb, offset); \ |
1922 | val_len_len = 1; \ |
1923 | } \ |
1924 | offset += val_len_len + val_len; \ |
1925 | /* Value with length processing starts HERE \ |
1926 | * The value lies between val_start and offset: \ |
1927 | * - Value Length: Start = val_start \ |
1928 | * Length = val_len_len \ |
1929 | * - Value Data : Start = val_start + val_len_len \ |
1930 | * Length = val_len \ |
1931 | * End = offset - 1 \ |
1932 | * BEGIN */ |
| |
|
| 3601 | | | off = val_start + val_len_len; |
| 3602 | | | warn_code = tvb_get_guint8(tvb, off++); |
| 3603 | | | if (warn_code & 0x80) { |
| 3604 | | | val_str = match_strval(val, vals_wsp_profile_warning_code); |
| 3605 | | | if (val_str) { |
| 3606 | | | tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); |
| 3607 | | | ti = proto_tree_add_string(tree, hf_hdr_profile_warning, |
| 3608 | | | tvb, hdr_start, offset - hdr_start, val_str); |
| 3609 | | | get_uri_value(str, tvb, off, len, ok);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1284 | #define get_uri_value(str,tvb,start,len,ok) \ |
1285 | get_text_string(str,tvb,start,len,ok) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1271 | #define get_text_string(str,tvb,start,len,ok) \ |
1272 | if (is_text_string(tvb_get_guint8(tvb,start))) { \ |
1273 | str = (gchar *)tvb_get_stringz(tvb,start,(gint *)&len); \ |
1274 | ok = TRUE; \ |
1275 | } else { len = 0; str = NULL; ok = FALSE; } |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1232 | #define is_text_string(x) ( ((x) == 0) || ( ((x) >= 32) && ((x) <= 127)) ) |
| |
|
Ignored Return Value
The return value of tvb_get_stringz() 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 tvb_get_stringz() 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 tvb_get_stringz() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events
Event 2:
!0 evaluates to true.
hide
|
|
| 3610 | | | if (ok) { |
Event 3:
Taking true branch. ok evaluates to true.
hide
|
|
| 3611 | | | off += len; |
| 3612 | | | str = g_strdup_printf("; target=%s", val_str); |
| 3613 | | | proto_item_append_string(ti, str); |
| 3614 | | | g_free(str); |
| 3615 | | | |
| 3616 | | | while (ok && (off < offset)) { |
Event 11:
Continuing from loop body. Leaving loop. ok evaluates to false.
hide
|
|
| 3617 | | | get_date_value(val, tvb, off, len, ok);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1264 | #define get_date_value(val,tvb,start,len,ok) \ |
1265 | get_long_integer(val,tvb,start,len,ok) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1245 | #define get_long_integer(val,tvb,start,len,ok) \ |
1246 | len = tvb_get_guint8(tvb,start); \ |
1247 | ok = TRUE; /* Valid lengths for us are 1-4 */ \ |
1248 | if (len==1) { val = tvb_get_guint8(tvb,start+1); } \ |
1249 | else if (len==2) { val = tvb_get_ntohs(tvb,start+1); } \ |
1250 | else if (len==3) { val = tvb_get_ntoh24(tvb,start+1); } \ |
1251 | else if (len==4) { val = tvb_get_ntohl(tvb,start+1); } \ |
1252 | else ok = FALSE; \ |
1253 | len++; /* Add the 1st octet to the length */ |
| |
|
Event 5:
!0 evaluates to true.
hide
Event 6:
Taking false branch. len == 1 evaluates to false.
hide
Event 7:
Taking false branch. len == 2 evaluates to false.
hide
Event 8:
Taking false branch. len == 3 evaluates to false.
hide
Event 9:
Taking false branch. len == 4 evaluates to false.
hide
|
|
| 3618 | | | if (ok) { |
Event 10:
Skipping " if". ok evaluates to false.
hide
|
|
| 3619 | | | off += len; |
| 3620 | | | tv.secs = val; |
| 3621 | | | tv.nsecs = 0; |
| 3622 | | | val_str = abs_time_to_str(&tv); |
| 3623 | | | str = g_strdup_printf("; date=%s", val_str); |
| 3624 | | | proto_item_append_string(ti, str); |
| 3625 | | | g_free(str); |
| 3626 | | | |
| 3627 | | | |
| 3628 | | | |
| 3629 | | | |
| 3630 | | | } |
| 3631 | | | } |
| 3632 | | | } |
| 3633 | | | } |
| 3634 | | | } |
| 3635 | | | wkh_4_End(hf_hdr_profile_warning);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wsp.c |
| |
1934 | #define wkh_4_End(hf) /* End of value parsing */ \ |
1935 | /* END */ \ |
1936 | } \ |
1937 | /* Check for errors */ \ |
1938 | if (! ok) { \ |
1939 | if (ti) { /* Append to protocol tree item label */ \ |
1940 | proto_item_append_text(ti, \ |
1941 | " <Error: Invalid value>"); \ |
1942 | } else if (hf > 0) { /* Create protocol tree item */ \ |
1943 | tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ |
1944 | proto_tree_add_string(tree, hf, \ |
1945 | tvb, hdr_start, offset - hdr_start, \ |
1946 | " <Error: Invalid value>"); \ |
1947 | } else { /* Create anonymous field entry */ \ |
1948 | tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ |
1949 | proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, \ |
1950 | "%s: <Error: Invalid value>", \ |
1951 | val_to_str (hdr_id, vals_field_names, \ |
1952 | "<Unknown WSP field 0x%02X>")); \ |
1953 | } \ |
1954 | } \ |
1955 | return offset; |
| |
|
Event 12:
Taking true branch. ok evaluates to false.
hide
Event 13:
Taking true branch. ti evaluates to true.
hide
|
|
| 3636 | | | } |
| |