Text   |  XML   |  ReML   |   Visible Warnings:

Redundant Condition  at mail-cache-transaction.c:291

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mail_cache_unlink_hole

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-cache-transaction.c)expand/collapse
Show more  
 260  static bool mail_cache_unlink_hole(struct mail_cache *cache, size_t size,
 261                                     struct mail_cache_hole_header *hole_r)
 262  {
 263          struct mail_cache_header *hdr = &cache->hdr_copy;
 264          struct mail_cache_hole_header hole;
 265          uint32_t offset, prev_offset;
 266   
 267          i_assert(cache->locked);
 268   
 269          offset = hdr->hole_offset; prev_offset = 0;
 270          while (offset != 0) {
 271                  if (pread_full(cache->fd, &hole, sizeof(hole), offset) <= 0) {
 272                          mail_cache_set_syscall_error(cache, "pread_full()");
 273                          return FALSE;
 274                  }
 275   
 276                  if (hole.magic != MAIL_CACHE_HOLE_HEADER_MAGIC) {
 277                          mail_cache_set_corrupted(cache,
 278                                  "Invalid magic in hole header");
 279                          return FALSE;
 280                  }
 281   
 282                  if (hole.size >= size)
 283                          break;
 284   
 285                  prev_offset = offset;
 286                  offset = hole.next_offset;
 287          }
 288          if (offset == 0)
 289                  return FALSE;
 290   
 291          if (prev_offset == 0)
 292                  hdr->hole_offset = hole.next_offset;
 293          else {
 294                  if (mail_cache_write(cache, &hole.next_offset,
 295                                       sizeof(hole.next_offset), prev_offset) < 0)
 296                          return FALSE;
 297          }
 298          hdr->deleted_space -= hole.size;
 299          cache->hdr_modified = TRUE;
 300   
 301          hole_r->next_offset = offset;
 302          hole_r->size = hole.size;
 303          return TRUE;
 304  }
Show more  




Change Warning 7229.24954 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: