(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ipsec.c) |
| |
| 646 | | | esp_sa_parse_spi(const gchar *sa, guint index_start, gchar **pt_spi, guint *index_end) |
| 647 | | | { |
| 648 | | | guint cpt = 0; |
| 649 | | | guint32 spi = 0; |
| 650 | | | guint i = 0; |
| 651 | | | |
| 652 | | | gchar spi_string[IPSEC_SPI_LEN_MAX + 1]; |
| 653 | | | gchar spi_string_tmp[IPSEC_SPI_LEN_MAX + 1]; |
| 654 | | | gboolean done_flag = FALSE; |
| 655 | | | |
| 656 | | | if((sa == NULL) || (strcmp(sa, "") == 0)) return FALSE; |
| 657 | | | |
| 658 | | | while(((cpt + index_start) < strlen(sa)) && (cpt < IPSEC_SPI_LEN_MAX)) |
| 659 | | | { |
| 660 | | | spi_string[cpt] = toupper(sa[cpt + index_start]); |
| 661 | | | cpt ++; |
| 662 | | | } |
| 663 | | | |
| 664 | | | if(cpt == 0) |
| 665 | | | done_flag = FALSE; |
| 666 | | | else |
| 667 | | | { |
| 668 | | | spi_string[cpt] = '\0'; |
| 669 | | | if((cpt >= 2) && |
| 670 | | | (spi_string[0] == '0') && |
| 671 | | | (spi_string[1] == 'X')) |
| 672 | | | { |
| 673 | | | for(i = 0; i <= cpt - 2; i++) spi_string_tmp[i] = spi_string[i+2]; |
| 674 | | | sscanf(spi_string_tmp,"%x",&spi); |
Ignored Return Value
The return value of __isoc99_sscanf() 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.
- CodeSonar is configured to enforce Ignored Return Value checks for __isoc99_sscanf(). (To change the set of enforced Ignored Return Value checks, use configuration file parameters RETURN_CHECKER_CHECKED_FUNCS and RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 675 | | | g_snprintf(spi_string, IPSEC_SPI_LEN_MAX, "%i", spi); |
| 676 | | | } |
| 677 | | | |
| 678 | | | *index_end = cpt + index_start - 1; |
| 679 | | | *pt_spi = (gchar *)g_malloc((strlen(spi_string) + 1) * sizeof(gchar)); |
| 680 | | | memcpy(*pt_spi, spi_string, strlen(spi_string) + 1); |
| 681 | | | |
| 682 | | | done_flag = TRUE; |
Event 2:
!0 evaluates to true.
hide
|
|
| 683 | | | } |
| 684 | | | |
| 685 | | | return done_flag; |
| 686 | | | } |
| |