Text   |  XML   |  ReML   |   Visible Warnings:

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

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

mail_cache_register_fields

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-cache-fields.c)expand/collapse
Show more  
 68  void mail_cache_register_fields(struct mail_cache *cache,
 69                                  struct mail_cache_field *fields,
 70                                  unsigned int fields_count)
 71  {
 72          void *orig_key, *orig_value;
 73          char *name;
 74          unsigned int new_idx;
 75          unsigned int i, j;
 76   
 77          new_idx = cache->fields_count;
 78          for (i = 0; i < fields_count; i++) {
 79                  if (hash_table_lookup_full(cache->field_name_hash,
 80                                             fields[i].name,
 81                                             &orig_key, &orig_value)) {
 82                          i_assert(fields[i].type < MAIL_CACHE_FIELD_COUNT);
 83   
 84                          fields[i].idx =
 85                                  POINTER_CAST_TO(orig_value, unsigned int);
 86                          (void)field_type_verify(cache, fields[i].idx,
 87                                                  fields[i].type,
 88                                                  fields[i].field_size);
 89                          continue;
 90                  }
 91   
 92                  /* check if the same header is being registered in the
 93                     same field array */
 94                  for (j = 0; j < i; j++) {
 95                          if (strcasecmp(fields[i].name, fields[j].name) == 0) {
 96                                  fields[i].idx = fields[j].idx;
 97                                  break;
 98                          }
 99                  }
 100   
 101                  if (j == i)
 102                          fields[i].idx = new_idx++;
 103          }
 104   
 105          if (new_idx == cache->fields_count)
 106                  return;
 107   
 108          /* @UNSAFE */
 109          cache->fields = i_realloc(cache->fields,
 110                                    cache->fields_count * sizeof(*cache->fields),
 111[+]                                   new_idx * sizeof(*cache->fields));
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 11818.24951 : Integer Overflow of Allocation Size

Because they are very similar, this warning shares annotations with warning 11818.24952.

Priority:
State:
Finding:
Owner:
Note: