(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ipsec.c) |
| |
| 1054 | | | filter_address_match(gchar *address, gchar *filter, gint len, gint typ) |
| 1055 | | | { |
| 1056 | | | gint i = 0; |
| 1057 | | | guint filter_tmp = 0; |
| 1058 | | | guint addr_tmp = 0; |
| 1059 | | | char filter_string_tmp[3]; |
| 1060 | | | char addr_string_tmp[3]; |
| 1061 | | | |
| 1062 | | | if(strlen(address) != strlen(filter)) return FALSE; |
| 1063 | | | |
| 1064 | | | if((len < 0) || ((typ == IPSEC_SA_IPV6) && (len > IPSEC_IPV6_ADDR_LEN)) || ((typ == IPSEC_SA_IPV4) && (len > IPSEC_IPV4_ADDR_LEN))) |
| 1065 | | | { |
| 1066 | | | for(i = 0; (guint)i < strlen(address); i++) |
| 1067 | | | { |
| 1068 | | | if((filter[i] != IPSEC_SA_WILDCARDS_ANY) && (filter[i] != address[i])) return FALSE; |
| 1069 | | | } |
| 1070 | | | return TRUE; |
| 1071 | | | } |
| 1072 | | | else |
| 1073 | | | { |
| 1074 | | | for(i = 0; i < (len/ 4); i++) |
| 1075 | | | { |
| 1076 | | | if((filter[i] != IPSEC_SA_WILDCARDS_ANY) && (filter[i] != address[i])) return FALSE; |
| 1077 | | | } |
| 1078 | | | |
| 1079 | | | if(filter[i] == IPSEC_SA_WILDCARDS_ANY) return TRUE; |
| 1080 | | | else if (len % 4 != 0) |
| 1081 | | | { |
| 1082 | | | |
| 1083 | | | filter_string_tmp[0] = filter[i]; |
| 1084 | | | filter_string_tmp[1] = '\0'; |
| 1085 | | | addr_string_tmp[0] = address[i]; |
| 1086 | | | addr_string_tmp[1] = '\0'; |
| 1087 | | | |
| 1088 | | | sscanf(filter_string_tmp,"%x",&filter_tmp); |
| 1089 | | | sscanf(addr_string_tmp,"%x",&addr_tmp); |
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 |
|
| 1090 | | | for(i = 0; i < (len % 4); i++) |
| 1091 | | | { |
| 1092 | | | if(((filter_tmp >> (4 -i -1)) & 1) != ((addr_tmp >> (4 -i -1)) & 1)) |
| 1093 | | | { |
| 1094 | | | return FALSE; |
| 1095 | | | } |
| 1096 | | | } |
| 1097 | | | } |
| 1098 | | | } |
| 1099 | | | |
| 1100 | | | return TRUE; |
Event 3:
!0 evaluates to true.
hide
|
|
| 1101 | | | |
| 1102 | | | } |
| |