(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/acl/acl-backend-vfile.c) |
| |
| 787 | | | static int acl_backend_vfile_object_refresh_cache(struct acl_object *_aclobj) |
| 788 | | | { |
| 789 | | | struct acl_object_vfile *aclobj = (struct acl_object_vfile *)_aclobj; |
| 790 | | | struct acl_backend_vfile *backend = |
| 791 | | | (struct acl_backend_vfile *)_aclobj->backend; |
| 792 | | | struct acl_backend_vfile_validity *old_validity; |
| 793 | | | struct acl_backend_vfile_validity validity; |
| 794 | | | time_t mtime; |
| 795 | | | int ret; |
| 796 | | | |
| 797 | | | old_validity = acl_cache_get_validity(_aclobj->backend->cache, |
| 798 | | | _aclobj->name); |
| 799 | | | ret = acl_backend_vfile_refresh(_aclobj, aclobj->global_path, |
| 800 | | | old_validity == NULL ? NULL : |
| 801 | | | &old_validity->global_validity); |
| 802 | | | if (ret == 0) { |
| 803 | | | ret = acl_backend_vfile_refresh(_aclobj, aclobj->local_path, |
| 804 | | | old_validity == NULL ? NULL : |
Redundant Condition
old_validity == (void *)0 always evaluates to false. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that old_validity == (void *)0 cannot be true.
- A crashing bug occurs on every path where old_validity == (void *)0 could have evaluated to true. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 805 | | | &old_validity->local_validity); |
| 806 | | | } |
| 807 | | | if (ret <= 0) |
| 808 | | | return ret; |
| 809 | | | |
| 810 | | | |
| 811 | | | if (!array_is_created(&aclobj->rights)) {
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
91 | #define array_is_created(array) \ |
92 | array_is_created_i(&(array)->arr) |
| |
|
| 812 | | | aclobj->rights_pool = |
| 813 | | | pool_alloconly_create("acl rights", 256); |
| 814 | | | i_array_init(&aclobj->rights, 16);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
37 | #define i_array_init(array, init_count) \ |
38 | p_array_init(array, default_pool, init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
35 | #define p_array_init(array, pool, init_count) \ |
36 | array_create(array, pool, sizeof(**(array)->v), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
75 | #define array_create(array, pool, element_size, init_count) \ |
76 | array_create_i(&(array)->arr, pool, element_size, init_count) |
| |
|
| 815 | | | } else { |
| 816 | | | array_clear(&aclobj->rights); |
| 817 | | | p_clear(aclobj->rights_pool); |
| 818 | | | } |
| 819 | | | |
| 820 | | | memset(&validity, 0, sizeof(validity)); |
| 821 | | | if (acl_backend_vfile_read_with_retry(aclobj, TRUE, aclobj->global_path, |
| 822 | | | &validity.global_validity) < 0) |
| 823 | | | return -1; |
| 824 | | | if (acl_backend_vfile_read_with_retry(aclobj, FALSE, aclobj->local_path, |
| 825 | | | &validity.local_validity) < 0) |
| 826 | | | return -1; |
| 827 | | | |
| 828 | | | acl_backend_vfile_rights_sort(aclobj); |
| 829 | | | |
| 830 | | | acl_backend_vfile_cache_rebuild(aclobj); |
| 831 | | | acl_cache_set_validity(_aclobj->backend->cache, |
| 832 | | | _aclobj->name, &validity); |
| 833 | | | |
| 834 | | | if (acl_backend_vfile_object_get_mtime(_aclobj, &mtime) == 0) |
| 835 | | | acl_backend_vfile_acllist_verify(backend, _aclobj->name, mtime); |
| 836 | | | return 0; |
| 837 | | | } |
| |