(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ssl.c) |
| |
| 308 | | | ssl_parse(void) |
| 309 | | | { |
| 310 | | | ep_stack_t tmp_stack; |
| 311 | | | SslAssociation *tmp_assoc; |
| 312 | | | FILE *ssl_keys_file; |
| 313 | | | struct stat statb; |
| 314 | | | size_t size; |
| 315 | | | gchar *tmp_buf; |
| 316 | | | size_t nbytes; |
| 317 | | | gboolean read_failed; |
| 318 | | | |
| 319 | | | ssl_set_debug(ssl_debug_file_name); |
| 320 | | | |
| 321 | | | if (ssl_key_hash) |
| 322 | | | { |
| 323 | | | g_hash_table_foreach(ssl_key_hash, ssl_private_key_free, NULL); |
| 324 | | | g_hash_table_destroy(ssl_key_hash); |
| 325 | | | } |
| 326 | | | |
| 327 | | | |
| 328 | | | tmp_stack = ep_stack_new(); |
| 329 | | | g_tree_foreach(ssl_associations, ssl_assoc_from_key_list, tmp_stack); |
| 330 | | | while ((tmp_assoc = ep_stack_pop(tmp_stack)) != NULL) { |
| 331 | | | ssl_association_remove(ssl_associations, tmp_assoc); |
| 332 | | | } |
| 333 | | | |
| 334 | | | |
| 335 | | | ssl_key_hash = g_hash_table_new(ssl_private_key_hash,ssl_private_key_equal); |
| 336 | | | |
| 337 | | | if (ssl_keys_list && (ssl_keys_list[0] != 0)) |
| 338 | | | { |
| 339 | | | if (file_exists(ssl_keys_list)) { |
| 340 | | | if ((ssl_keys_file = ws_fopen(ssl_keys_list, "r"))) { |
| 341 | | | read_failed = FALSE; |
| 342 | | | fstat(fileno(ssl_keys_file), &statb); |
Ignored Return Value
The return value of fstat() 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 fstat(). (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 |
|
| 343 | | | size = (size_t)statb.st_size; |
| 344 | | | tmp_buf = ep_alloc0(size + 1); |
| 345 | | | nbytes = fread(tmp_buf, 1, size, ssl_keys_file); |
| 346 | | | if (ferror(ssl_keys_file)) { |
Event 2:
Skipping " if". ferror(ssl_keys_file) evaluates to false.
hide
|
|
| 347 | | | report_read_failure(ssl_keys_list, errno); |
| 348 | | | read_failed = TRUE; |
| 349 | | | } |
| 350 | | | fclose(ssl_keys_file); |
| 351 | | | tmp_buf[nbytes] = '\0'; |
| 352 | | | if (!read_failed) |
Event 3:
Taking true branch. read_failed evaluates to false.
hide
|
|
| 353 | | | ssl_parse_key_list(tmp_buf,ssl_key_hash,ssl_associations,ssl_handle,TRUE); |
Event 4:
!0 evaluates to true.
hide
|
|
| 354 | | | } else { |
| 355 | | | report_open_failure(ssl_keys_list, errno, FALSE); |
| 356 | | | } |
| 357 | | | } else { |
| 358 | | | ssl_parse_key_list(ssl_keys_list,ssl_key_hash,ssl_associations,ssl_handle,TRUE); |
| 359 | | | } |
| 360 | | | } |
| 361 | | | ssl_debug_flush(); |
| 362 | | | } |
| |