Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at mail-cache-fields.c:95

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

index_header_lookup_init_real

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/index-mail-headers.c)expand/collapse
Show more  
 852  static struct mailbox_header_lookup_ctx *
 853  index_header_lookup_init_real(struct mailbox *box, const char *const headers[])
 854  {
 855          struct index_mailbox *ibox = (struct index_mailbox *)box;
 856          struct mail_cache_field *fields, header_field = {
 857                  NULL, 0, MAIL_CACHE_FIELD_HEADER, 0,
 858                  MAIL_CACHE_DECISION_TEMP 
 859          };
 860          struct index_header_lookup_ctx *ctx;
 861          const char *const *name;
 862          const char **sorted_headers;
 863          pool_t pool;
 864          unsigned int i, count;
 865   
 866          i_assert(*headers != NULL);
 867   
 868          for (count = 0, name = headers; *name != NULL; name++)
 869                  count++;
 870   
 871          /* @UNSAFE: headers need to be sorted for filter stream. */
 872          sorted_headers = t_new(const char *, count);
 873          memcpy(sorted_headers, headers, count * sizeof(*sorted_headers));
 874          qsort(sorted_headers, count, sizeof(*sorted_headers), i_strcasecmp_p);
 875          headers = sorted_headers;
 876   
 877          /* @UNSAFE */
 878[+]         fields = t_new(struct mail_cache_field, count);
 879          for (i = 0; i < count; i++) {
 880                  header_field.name = t_strconcat("hdr.", headers[i], NULL);
 881                  fields[i] = header_field;
 882          }
 883[+]         mail_cache_register_fields(ibox->cache, fields, count);
expand/collapse

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++;
Show more  
Show more  




Change Warning 7519.25012 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: