Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at mail-cache-fields.c:303

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

mail_cache_header_fields_read

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-cache-fields.c)expand/collapse
Show more  
 259  int mail_cache_header_fields_read(struct mail_cache *cache)
 260  {
 261          const struct mail_cache_header_fields *field_hdr = NULL;
 262          struct mail_cache_field field;
 263          const uint32_t *last_used, *sizes;
 264          const uint8_t *types, *decisions;
 265          const char *p, *names, *end;
 266          void *orig_key, *orig_value;
 267          unsigned int fidx, new_fields_count;
 268          enum mail_cache_decision_type dec;
 269          time_t max_drop_time;
 270          uint32_t offset, i;
 271   
 272[+]         if (mail_cache_header_fields_get_offset(cache, &offset, TRUE) < 0)
 273                  return -1;
 274   
 275          if (offset == 0) {
 276                  /* no fields - the file is empty */
 277                  return 0;
 278          }
 279   
 280          field_hdr = CONST_PTR_OFFSET(cache->data, offset);
 281          if (offset + field_hdr->size > cache->mmap_length) {
 282                  mail_cache_set_corrupted(cache,
 283                                           "field header points outside file");
 284                  return -1;
 285          }
 286   
 287          /* check the fixed size of the header. name[] has to be checked
 288             separately */
 289          if (field_hdr->size < sizeof(*field_hdr) +
 290              field_hdr->fields_count * (sizeof(uint32_t)*2 + 1 + 2)) {
 291                  mail_cache_set_corrupted(cache, "invalid field header size");
 292                  return -1;
 293          }
 294   
 295          field_hdr = CONST_PTR_OFFSET(cache->data, offset);
 296          new_fields_count = field_hdr->fields_count;
 297   
 298          if (new_fields_count != 0) {
 299                  cache->file_field_map =
 300                          i_realloc(cache->file_field_map,
 301                                    cache->file_fields_count *
 302                                    sizeof(unsigned int),
 303[+]                                   new_fields_count * sizeof(unsigned int));
expand/collapse

i_realloc

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/imem.c)expand/collapse
Show more  
 15  void *i_realloc(void *mem, size_t old_size, size_t new_size)
 16  {
 17      void *rv = realloc(mem, new_size);
Show more  
Show more  




Change Warning 11819.25022 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: