(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-wol.c) |
| |
| 90 | | | dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 91 | | | { |
| 92 | | | guint len; |
| 93 | | | gint offset; |
| 94 | | | guint8 sync[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 95 | | | guint8 *mac; |
| 96 | | | const guint8 *passwd; |
| 97 | | | |
| 98 | | | |
| 99 | | | proto_item *ti; |
| 100 | | | proto_item *mti; |
| 101 | | | proto_tree *wol_tree; |
| 102 | | | proto_tree *mac_tree; |
| 103 | | | |
| 104 | | | |
| 105 | | | |
| 106 | | | |
| 107 | | | |
| 108 | | | |
| 109 | | | |
| 110 | | | |
| 111 | | | |
| 112 | | | |
| 113 | | | len = tvb_length(tvb); |
| 114 | | | if ( len < 102 ) |
| 115 | | | return (0); |
| 116 | | | |
| 117 | | | |
| 118 | | | |
| 119 | | | |
| 120 | | | |
| 121 | | | |
| 122 | | | |
| 123 | | | if ( tvb_memeql(tvb, 0, sync, 6) != 0 ) |
| 124 | | | return (0); |
| 125 | | | |
| 126 | | | |
| 127 | | | |
| 128 | | | |
| 129 | | | mac = ep_tvb_memdup(tvb, 6, 6); |
| 130 | | | for ( offset = 12; offset < 102; offset += 6 ) |
| 131 | | | if ( tvb_memeql(tvb, offset, mac, 6) != 0 ) |
| 132 | | | return (0); |
| 133 | | | |
| 134 | | | |
| 135 | | | |
| 136 | | | |
| 137 | | | |
| 138 | | | if ( len >= 106 && len < 108 ) |
| 139 | | | { |
| 140 | | | len = 106; |
| 141 | | | passwd = ip_to_str(ep_tvb_memdup(tvb, 102, 4)); |
Ignored Return Value
The return value of ip_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 ip_to_str() is checked 99% 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 ip_to_str() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 142 | | | } |
| 143 | | | else if ( len >= 108 ) |
| 144 | | | { |
| 145 | | | len = 108; |
| 146 | | | passwd = ether_to_str(ep_tvb_memdup(tvb, 102, 6)); |
| 147 | | | } |
| 148 | | | else |
| 149 | | | { |
| 150 | | | len = 102; |
| 151 | | | passwd = NULL; |
| 152 | | | } |
| 153 | | | |
| 154 | | | |
| 155 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
Event 2:
Taking true branch. check_col(...) evaluates to true.
hide
|
|
| 156 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "WOL"); |
| 157 | | | |
| 158 | | | |
| 159 | | | |
| 160 | | | |
| 161 | | | |
| 162 | | | |
| 163 | | | |
| 164 | | | |
| 165 | | | |
| 166 | | | |
| 167 178 |  | | [ Lines 167 to 178 omitted. ] |
| 179 | | | |
| 180 | | | |
| 181 | | | |
| 182 | | | |
| 183 | | | |
| 184 | | | |
| 185 | | | |
| 186 | | | |
| 187 | | | |
| 188 | | | |
| 189 | | | if ( check_col(pinfo->cinfo, COL_INFO) ) |
Event 3:
Skipping " if". check_col(...) evaluates to false.
hide
|
|
| 190 | | | { |
| 191 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 192 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "MagicPacket for %s (%s)", |
| 193 | | | get_ether_name(mac), ether_to_str(mac)); |
| 194 | | | |
| 195 | | | |
| 196 | | | |
| 197 | | | |
| 198 | | | |
| 199 | | | if ( passwd ) |
| 200 | | | col_append_fstr(pinfo->cinfo, COL_INFO, ", password %s", passwd); |
| 201 | | | } |
| 202 | | | |
| 203 | | | |
| 204 | | | |
| 205 | | | |
| 206 | | | |
| 207 | | | |
| 208 | | | |
| 209 | | | |
| 210 | | | |
| 211 230 |  | | [ Lines 211 to 230 omitted. ] |
| 231 | | | |
| 232 | | | |
| 233 | | | |
| 234 | | | |
| 235 | | | |
| 236 | | | |
| 237 | | | |
| 238 | | | |
| 239 | | | |
| 240 | | | |
| 241 | | | if (tree) { |
Event 4:
Skipping " if". tree evaluates to false.
hide
|
|
| 242 | | | |
| 243 | | | |
| 244 | | | |
| 245 | | | |
| 246 | | | |
| 247 | | | |
| 248 | | | |
| 249 | | | |
| 250 | | | |
| 251 | | | |
| 252 | | | ti = proto_tree_add_item(tree, proto_wol, tvb, 0, len, FALSE); |
| 253 | | | proto_item_append_text(ti, ", MAC: %s (%s)", get_ether_name(mac), |
| 254 | | | ether_to_str(mac)); |
| 255 | | | if ( passwd ) |
| 256 | | | proto_item_append_text(ti, ", password: %s", passwd); |
| 257 | | | wol_tree = proto_item_add_subtree(ti, ett_wol); |
| 258 | | | |
| 259 | | | |
| 260 | | | proto_tree_add_item(wol_tree, hf_wol_sync, tvb, 0, 6, FALSE); |
| 261 | | | |
| 262 | | | |
| 263 | | | mti = proto_tree_add_text(wol_tree, tvb, 6, 96, "MAC: %s (%s)", |
| 264 | | | get_ether_name(mac), ether_to_str(mac)); |
| 265 | | | mac_tree = proto_item_add_subtree(mti, ett_wol_macblock); |
| 266 | | | for ( offset = 6; offset < 102; offset += 6 ) |
| 267 | | | proto_tree_add_ether(mac_tree, hf_wol_mac, tvb, offset, 6, mac); |
| 268 | | | |
| 269 | | | if ( len == 106 ) |
| 270 | | | proto_tree_add_bytes_format(wol_tree, hf_wol_passwd, tvb, offset, |
| 271 | | | 4, passwd, "Password: %s", passwd); |
| 272 | | | else if ( len == 108 ) |
| 273 | | | proto_tree_add_bytes_format(wol_tree, hf_wol_passwd, tvb, offset, |
| 274 | | | 6, passwd, "Password: %s", passwd); |
| 275 | | | } |
| 276 | | | |
| 277 | | | |
| 278 | | | |
| 279 | | | |
| 280 | | | if ( pinfo->ethertype == ETHERTYPE_WOL )
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/etypes.h |
| |
75 | #define ETHERTYPE_WOL 0x0842 /* Wake on LAN. Not offically registered. */ |
| |
|
Event 5:
Skipping " if". pinfo->ethertype == 2114 evaluates to false.
hide
|
|
| 281 | | | return (len); |
| 282 | | | |
| 283 | | | |
| 284 | | | return (TRUE); |
Event 6:
!0 evaluates to true.
hide
|
|
| 285 | | | } |
| |