Unused Value at packet-msrp.c:374 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
check_msrp_header (/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-msrp.c)![]() | ||||||
![]() | ||||||
355 | check_msrp_header(tvbuff_t *tvb) | |||||
356 | { | |||||
357 | gint offset = 0; | |||||
358 | gint linelen; | |||||
359 | gint space_offset; | |||||
360 | gint next_offset = 0; | |||||
361 | guint token_1_len; | |||||
362 | gint token_2_start; | |||||
363 | ||||||
364 | /* | |||||
365 | * Note that "tvb_find_line_end()" will return a value that | |||||
366 | * is not longer than what's in the buffer, so the | |||||
367 | * "tvb_get_ptr()" calls below won't throw exceptions. * | |||||
368 | */ | |||||
369 | offset = 0; | |||||
370 | if(tvb_length(tvb) < 4 || tvb_get_ntohl(tvb, 0) != 0x4d535250 /* MSRP */){ | |||||
371 | return FALSE; | |||||
372 | } | |||||
373 | ||||||
374 | linelen = tvb_find_line_end(tvb, 0, -1, &next_offset, FALSE);
| |||||
375 | /* Find the first SP */ | |||||
376 | space_offset = tvb_find_guint8(tvb, 0, -1, ' '); | |||||
377 | ||||||
378 | if (space_offset <= 0) { | |||||
379 | /* | |||||
380 | * Either there's no space in the line (which means | |||||
381 | * the line is empty or doesn't have a token followed | |||||
382 | * by a space; neither is valid for a request or response), or | |||||
383 | * the first character in the line is a space ( which isn't valid | |||||
384 | * for a MSRP header.) | |||||
385 | */ | |||||
386 | return FALSE; | |||||
387 | } | |||||
388 | ||||||
389 | token_1_len = space_offset; | |||||
390 | token_2_start = space_offset + 1; | |||||
391 | space_offset = tvb_find_guint8(tvb, token_2_start, -1, ' '); | |||||
392 | if (space_offset == -1) { | |||||
393 | /* | |||||
394 | * There's no space after the second token, so we don't | |||||
395 | * have a third token. | |||||
396 | */ | |||||
397 | return FALSE; | |||||
398 | } | |||||
399 | /* | |||||
400 | * Is the first token "MSRP"? | |||||
401 | */ | |||||
402 | if (token_1_len == MSRP_HDR_LEN) { /* && tvb_strneql(tvb, 0, MSRP_HDR, MSRP_HDR_LEN) == 0){ */ | |||||
403 | /* This check can be made more strict but accept we do have MSRP for now */ | |||||
404 | return TRUE; | |||||
405 | ||||||
406 | } | |||||
407 | return FALSE; | |||||
408 | } | |||||
![]() |